import * as Yup from "yup";

import { Student } from "../../types/Item";
import dayjs from "dayjs";

export const getInitialValues = (objectToEdit: any): any => {
  return {
    id: objectToEdit?.id ?? null,
    email: objectToEdit?.user?.email ?? null,
    notes: objectToEdit?.notes ?? null,
    password: objectToEdit?.user.password ?? null,

    image: objectToEdit?.image ?? null,
    nationality: objectToEdit?.nationality ?? null,
    birth_place: objectToEdit?.birth_place ?? null,
    birthday: objectToEdit?.birthday
      ? dayjs(objectToEdit?.birthday, "YYYY/MM/DD")
      : 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 = () => {
  // validate input
  return Yup.object().shape({
    // name: Yup.string().required('مطلوب'),
    // description: Yup.string().required('مطلوب'),
    // categories_id: Yup.string().required('مطلوب'),
    // price: Yup.number().required('مطلوب'),
    // is_published: Yup.boolean().required("required"),
    // image: Yup.string().required('مطلوب'),
  });
};
