import * as Yup from "yup";

// Function to get the initial values
export const getInitialValues = (objectToEdit: any): any => {
  console.log(objectToEdit);

  return {
    id: objectToEdit?.id ?? null,
    phone_number: objectToEdit?.phone_number ?? null,
    currentModalIndex: 0,
    package_id: objectToEdit?.package_id ?? null,
    student_id: objectToEdit?.student_id ?? null,
    coupon_id: objectToEdit?.coupon_id ?? null,
  };
};

// Validation schema with Yup
export const getValidationSchema = () => {
  return Yup.object().shape({
    phone_number: Yup.string()
      .required("Phone number is required")
      .length(10, "Phone number must be exactly 10 digits")
      .matches(/^\d{10}$/, "Phone number must be a valid 10-digit number"),
    currentModalIndex: Yup.number().max(2),
  });
};
