import * as Yup from "yup";

export const getInitialValues = (objectToEdit: any): any => {
  return {
    id: objectToEdit?.id ?? null,
    // username:objectToEdit?.username ?? null   ,
    email: objectToEdit?.email ?? "",
    username: objectToEdit?.username ?? null,

    password: objectToEdit?.password ?? null,
    notes: objectToEdit?.notes ?? null,
    image: objectToEdit?.image ?? null,
    nationality: objectToEdit?.nationality ?? null,
    birth_place: objectToEdit?.birth_place ?? null,
    birthday: objectToEdit?.birthday ?? null,
    phone_number_2: objectToEdit?.phone_number_2 ?? null,
    phone_number_1: objectToEdit?.phone_number_1 ?? null,
    mother_name: objectToEdit?.mother_name ?? null,
    father_name: objectToEdit?.father_name ?? null,
    last_name: objectToEdit?.last_name ?? null,
    first_name: objectToEdit?.first_name ?? null,
    religion: objectToEdit?.religion ?? null,
    attachments: objectToEdit?.attachments ?? null,
    attachment1: objectToEdit?.attachment1 ?? null,
    attachment2: objectToEdit?.attachment2 ?? null,
    address: objectToEdit?.address ?? null,

    father_job: objectToEdit?.father_job ?? null,
    mother_phone_number: objectToEdit?.mother_phone_number ?? null,
    father_phone_number: objectToEdit?.father_phone_number ?? null,
    mother_job: objectToEdit?.mother_job ?? null,
    edu_class_id: objectToEdit?.edu_class_id ?? null,
    sex: objectToEdit?.sex ?? null,
  };
};

export const getValidationSchema = () => {
  return Yup.object().shape({
    // username: Yup.string().required('Username is required'),
    email: Yup.string().email("validation.Invalid_email"),
    username: Yup.string().required("validation.required"),
    // .required("validation.Email_is_required"),
    password: Yup.string()
      .required("validation.Password_is_required")
      .min(8, "validation.Password_must_be_at_least_8_characters_long"),
    // notes: Yup.string(),
    // image: Yup.string().required(),
    nationality: Yup.string().required("validation.Nationality_is_required"),
    address: Yup.string().required("validation.Address_is_required"),

    birth_place: Yup.string().required("validation.Place_of_birth_is_required"),
    birthday: Yup.string().required("validation.Date_of_birth_is_required"),
    // phone_number_2: Yup.number(),
    // phone_number_1: Yup.number(),
    mother_name: Yup.string().required("validation.Mother's_name_is_required"),
    father_name: Yup.string().required("validation.Father's_name_is_required"),
    last_name: Yup.string().required("validation.Last_name_is_required"),
    first_name: Yup.string().required("validation.First_name_is_required"),
    religion: Yup.string().required("validation.Religion_is_required"),
    sex: Yup.string().required("validation.Gender_is_required"),

    // attachments: Yup.string(),
    // attachment1: Yup.string(),
    // attachment2: Yup.string(),
    // attachment1: Yup.string().required("validation.Attachment1_is_required"),

    father_job: Yup.string().required("validation.Father's_job_is_required"),
    // mother_phone_number: Yup.string().required(
    //   "validation.Mother's_phone_number_is_required",
    // ),
    father_phone_number: Yup.string().required(
      "validation.Father's_phone_number_is_required",
    ),
    // mother_job: Yup.string().required("validation.Mother's_job_is_required"),
  });
};
