
import * as Yup from "yup";
import { buildFormData } from "../../api/helper/buildFormData";


export const getInitialValues = (objectToEdit: any | null = null): any => {
  //@ts-ignore
  return {
    // id: objectToEdit?.id ,
    new_password: objectToEdit?.password ,
    old_password: objectToEdit?.old_password ,


  };
};

export const getInitialValuesForAdd = (objectToEdit: any | null = null): any => {
  return {
    password: null ,


  };
};

export const getValidationSchema = (editMode: boolean = false): Yup.Schema<any> => {
  // Validate input
  return Yup.object().shape({


  });
};



export const getDataToSend = (values: any): FormData => {
  const data = { ...values };


  const formData = new FormData();
  buildFormData(formData, data);
  return formData;
};

export const ChangeDataToPrint = (data: any) => {

  let new_array = data
  for (let i = 0; i < data.length; i++) {
    new_array[i]['status'] = !data[i]['deleted_at'] ? 'available' : 'unavailable'
    delete new_array[i]['deleted_at']
  }
  return new_array
}