import { FC } from "react";
import { Stack } from "@mantine/core";
import { DealSchema } from "@/lib/client";
import ClientDataForm from "@/modules/dealModularEditorTabs/Clients/components/ClientDataForm";
import ClientSelectForm from "@/modules/dealModularEditorTabs/Clients/components/ClientSelectForm";
import { ClientTabContextProvider } from "./contexts/ClientTabContext";

type Props = {
    value: DealSchema;
    onChange: (value: DealSchema) => void;
};

const ClientTab: FC<Props> = ({ value, onChange }) => {
    return (
        <Stack
            flex={1}
            mt={"xs"}
            mx={"xs"}>
            <ClientTabContextProvider
                value={value}
                onChange={onChange}>
                <ClientSelectForm />
                <ClientDataForm />
            </ClientTabContextProvider>
        </Stack>
    );
};

export default ClientTab;
