import {BarcodeTemplateSchema} from "../../../../client";
import {MRT_ColumnDef} from "mantine-react-table";
import {useMemo} from "react";
import {IconCheck, IconX} from "@tabler/icons-react";

export const useBarcodeTemplatesTableColumns = () => {
    return useMemo<MRT_ColumnDef<BarcodeTemplateSchema>[]>(() => [
        {
            accessorKey: "name",
            header: "Название",
        },
        {
            accessorKey: "attributes",
            header: "Атрибуты",
            Cell: ({row}) => <>{row.original.attributes.map(attr => attr.name).join(', ')}</>
        },
        {
            accessorKey: "size.name",
            header: "Размер",
        },
        {
            accessorKey: "isDefault",
            header: "По умолчанию",
            Cell: ({row}) => row.original.isDefault ? <IconCheck/> : <IconX/>
        }
    ], []);
}