import * as Yup from "yup";

export const getInitialValues = (objectToEdit: any): any => {
  // console.log(objectToEdit,"objectToEdit");
  const teacher_ids = objectToEdit?.teachers?.map((item: any) => {
    return item?.id;
  });

  return {
    id: objectToEdit?.id ?? null,
    name: objectToEdit?.name ?? null,
    image: objectToEdit?.image ?? null,
    teacher_ids: teacher_ids ?? [],
  };
};

export const getValidationSchema = () => {
  // validate input
  return Yup.object().shape({
    name: Yup.string().required("validation.required"),
    // image: Yup.string().required("validation.required"),
    teacher_ids: Yup.array().required("validation.required"),
  });
};
