import { FC } from "react";
import { useBarcodeTemplatesTableColumns } from "@/app/barcode-templates/components/shared/BarcodeTemplatesTable/columns";
import BaseTable from "@/components/ui/BaseTable/BaseTable";
import useIsMobile from "@/hooks/utils/useIsMobile";
import { BarcodeTemplateSchema } from "@/lib/client";

type Props = {
    items: BarcodeTemplateSchema[];
    onDelete: (template: BarcodeTemplateSchema) => void;
    onChange: (template: BarcodeTemplateSchema) => void;
};

const BarcodeTemplatesTable: FC<Props> = ({ items, ...props }) => {
    const isMobile = useIsMobile();
    const columns = useBarcodeTemplatesTableColumns(props);

    return (
        <BaseTable
            striped
            withTableBorder
            records={items}
            columns={columns}
            groups={undefined}
            verticalSpacing={"md"}
            mx={isMobile ? "xs" : ""}
        />
    );
};

export default BarcodeTemplatesTable;
