import { FC } from "react";
import { Divider, Stack } from "@mantine/core";
import BaseTable from "@/components/ui/BaseTable/BaseTable";
import useModulesTableColumns from "@/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/hooks/useModulesTableColumns";
import useModulesList from "@/hooks/lists/useModulesList";
import { ModuleSchemaOutput } from "@/lib/client";

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

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

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

export default ModulesTable;
