/* eslint-disable @typescript-eslint/no-explicit-any */
import * as Yup from "yup";
interface StaffFormValues {
  employee_id: string;
  first_name: string;
  last_name: string;
  first_name_ar: string;
  last_name_ar: string;
  name: string;
  email: string;
  phone: string;
  user_name: string;
  password: string;
  c_password: string;
  profile_pic: File | null;

  // Make these fields optional if they are not always required
  address_line_one?: string;
  address_line_two?: string;

  block: any; // Add actual types if possible
  road: any; // Add actual types if possible
  building: any; // Add actual types if possible
  nationality: any; // Add actual types if possible
}
export const validationSchema = Yup.object().shape({
  employee_id: Yup.string().required("Employee ID is required"),

  first_name: Yup.string().required("First name is required"),
  last_name: Yup.string().required("Last name is required"),
  first_name_ar: Yup.string().nullable(), // Optional
  last_name_ar: Yup.string().nullable(), // Optional

  email: Yup.string().email("Invalid email").required("Email is required"),
  phone: Yup.string()
    .matches(/^[0-9]{10,15}$/, "Phone must be valid")
    .required("Phone is required"),

  user_name: Yup.string().required("Username is required"),

  password: Yup.string()
    .min(6, "Password must be at least 6 characters")
    .required("Password is required"),

  c_password: Yup.string()
    .oneOf([Yup.ref("password"), ""], "Passwords must match")
    .required("Confirm Password is required"),

  profile_pic: Yup.mixed().nullable(),

  nationality: Yup.mixed().nullable().required("Nationality is required"),

  block: Yup.mixed().nullable().required("Block is required"),

  road: Yup.mixed().nullable().required("Road is required"),

  building: Yup.mixed().nullable().required("Building is required"),
});

export const initialValues: StaffFormValues = {
  employee_id: "",
  first_name: "",
  last_name: "",
  first_name_ar: "",
  last_name_ar: "",
  name: "",
  email: "",
  phone: "",
  user_name: "",
  password: "",
  c_password: "",
  profile_pic: null,

  // Include the missing fields
  address_line_one: "", // You can set a default empty string or null
  address_line_two: "", // Same as above

  block: null,
  road: null,
  building: null,
  nationality: null,
};
