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 LayoutModel from "./LayoutModel";
import { useObjectToEdit } from "../../../../zustand/ObjectToEditState";
import { salesModelEnum } from "../../../../enums/salesForms";

const AddModel: React.FC = () => {

  const { objectToEdit } = useObjectToEdit();
  const handleSubmit = () => {};
  const Forms = {
    [salesModelEnum.Number]:  <ValidationModelForm /> ,
    [salesModelEnum.Package] : <SalesModelForm /> ,
    [salesModelEnum.Submit]:  <SubmitModelForm /> 
  }
  console.log(objectToEdit);

  return (
    <>
      <LayoutModel
        status={objectToEdit?.status as QueryStatusEnum}
        ModelEnum={ModalEnum.Sales_ADD}
        handleSubmit={handleSubmit}
        getInitialValues={getInitialValues(objectToEdit)}
        getValidationSchema={getValidationSchema}
      >
        {Forms[salesModelEnum.Number]}
        {Forms[salesModelEnum.Package]}
        {Forms[salesModelEnum.Submit]}
      </LayoutModel>
    </>
  );
};

export default AddModel;
