make it correct and same me if there are any errors import { useState } from "react";
import { omit } from "lodash";
import toast from "../../components/toast";

const useUserClaimValidation = (callback) => {
  const [values, setValues] = useState({});
  const [errors, setErrors] = useState({});

  const validate = (password, value, NewPassword, ConfirmPassword) => {
    switch (password) {
      case "OldPassword":
        if (!value) {
          setErrors({
            ...errors,
            OldPassword: "Please enter your old password",
          });
        } else {
          if (
            !/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,16}$/.test(
              value
            )
          ) {
            setErrors({
              ...errors,
              OldPassword:
                "Password must be at least 8-16 characters, contains uppercase & lowercase letters, numbers, and special characters (e.g., %5)",
            });
          } else {
            let newObj = omit(errors, "OldPassword");
            setErrors(newObj);
          }
        }
        break;

      case "NewPassword":
        if (!value) {
          setErrors({
            ...errors,
            NewPassword: "Please enter your new password",
          });
        } else {
          if (
            !/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,16}$/.test(
              value
            )
          ) {
            setErrors({
              ...errors,
              NewPassword:
                "Password must be at least 8-16 characters, contains uppercase & lowercase letters, numbers, and special characters (e.g., %5)",
            });
          } else {
            let newObj = omit(errors, "NewPassword");
            setErrors(newObj);
          }
        }
        break;

      case "ConfirmPassword":
        if (!value) {
          setErrors({
            ...errors,
            ConfirmPassword: "Please confirm your new password",
          });
        } else {
          if (
            !/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,16}$/.test(
              value
            )
          ) {
            setErrors({
              ...errors,
              ConfirmPassword:
                "Password must be at least 8-16 characters, contains uppercase & lowercase letters, numbers, and special characters (e.g., %5)",
            });
          } else if (NewPassword !== ConfirmPassword) {
            setErrors({
              ...errors,
              ConfirmPassword:
                "The new password and confirm pas