import moment from "jalali-moment";

export const dateToTimestamp = (date) => {
  const gregorianMoment = moment(date, "jYYYY/jM/jD").locale("fa");
  const unixTimestamp = gregorianMoment.valueOf();
  return unixTimestamp / 1000;
};

export const transformData = (data) => {
  return {
    name: data.name.value,
    activity_time: dateToTimestamp(data.time_work.value),
    doctor_mobile_number: data.phone.value,
    degree: data.degree.value,
    specialty: [data.expertise.value],
    info: data.description.value,
    doctor_id: data.medical_system_number.value,
    doctor_services: data.skills.value,
    gender: data.gender.value,
  };
};
