import { FC } from "react";
import { Divider, Stack } from "@mantine/core";
import useModulesTableColumns from "@/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/hooks/useModulesTableColumns";
import BaseTable from "@/components/ui/BaseTable/BaseTable";
import useBuiltInModulesList from "@/hooks/lists/useBuiltInModulesList";
import { BuiltInModuleSchemaOutput } from "@/lib/client";

type Props = {
    selectedRecords: BuiltInModuleSchemaOutput[];
    onSelectedRecordsChange: (records: BuiltInModuleSchemaOutput[]) => void;
};

const ModulesTable: FC<Props> = props => {
    const columns = useModulesTableColumns();
    const { builtInModules } = useBuiltInModulesList();

    return (
        <Stack gap={0}>
            <Divider />
            <BaseTable
                records={builtInModules}
                columns={columns}
                verticalSpacing={"md"}
                allRecordsSelectionCheckboxProps={{
                    hidden: true,
                }}
                {...props}
            />
        </Stack>
    );
};

export default ModulesTable;
