import * as Yup from "yup";
import dayjs from "dayjs";

export const getInitialValues = (objectToEdit: any): any => {
  return {
    id: objectToEdit?.id ?? null,
    activation_date: objectToEdit?.activation_date
      ? dayjs(objectToEdit?.activation_date, "YYYY/MM/DD")
      : null,
    expiration_date: objectToEdit?.expiration_date
      ? dayjs(objectToEdit?.expiration_date, "YYYY/MM/DD")
      : null,
    student_id: objectToEdit?.student_id ?? null,
    package_id: objectToEdit?.package_id ?? null,
  };
};
export const getValidationSchema = () => {
  return Yup.object().shape({
    activation_date: Yup.mixed().required("validation.required"),
    expiration_date: Yup.mixed().required("validation.required"),
    student_id: Yup.number().required("validation.required"),
    package_id: Yup.number().required("validation.required"),
  });
};
