import React from "react";
import { getInitialValues, getValidationSchema } from "./formUtil";
import { ModalEnum } from "../../../../enums/Model";
import { QueryStatusEnum } from "../../../../enums/QueryStatus";
import ValidationModelForm from "./ValidationModelForm";
import SalesModelForm from "./SalesModelForm";
import SubmitModelForm from "./SubmitModelForm";

import { useAddSales } from "../../../../api/sales";
import LayoutModel from "./LayoutModel";
import { useObjectToEdit } from "../../../../zustand/ObjectToEditState";

const AddModel: React.FC = () => {
  const { mutate, status } = useAddSales();

  const handleSubmit = (values: any) => {
    // mutate({
    //   ...values,
    // });
  };
  enum modal {
    Number= 0,
    Package= 1,
    Sure= 2
  } 

  const Forms = {
    [modal.Number]:  <ValidationModelForm /> ,
    [modal.Package] : <SalesModelForm /> ,
    [modal.Sure]:  <SubmitModelForm /> 
  }
  // const modelTitle = Forms.[modal.Number] ? "sale" : Forms.Package ? "adcs" : "Ascas";  
  const { objectToEdit,setObjectToEdit } = useObjectToEdit();
console.log(objectToEdit);

  
  return (
    <>
      <LayoutModel
        status={status as QueryStatusEnum}
        ModelEnum={ModalEnum.Sales_ADD}
        modelTitle={"modelTitle"}
        handleSubmit={handleSubmit}
        getInitialValues={getInitialValues({})}
        getValidationSchema={getValidationSchema}
        initialButtonName={false}
        buttonTitle="search"
      >
        {/* {Forms["Number"]} */}
        <>
          <ValidationModelForm/>
          <SalesModelForm/>
          <SubmitModelForm/>
        </>

      </LayoutModel>
    </>
  );
};

export default AddModel;
