import {useMemo} from "react";
import {MRT_ColumnDef} from "mantine-react-table";
import {PayRateSchema} from "../../../../client";

export const usePayRatesTableColumns = () => {
    return useMemo<MRT_ColumnDef<PayRateSchema>[]>(() => [
        {
            accessorKey: "name",
            header: "Название тарифа"
        },
        {
            accessorKey: "payrollScheme.name",
            header: "Система оплаты"
        },
        {
            accessorKey: "baseRate",
            header: "Базовая ставка",
            Cell: ({row}) => `${row.original.baseRate.toLocaleString("ru")}₽`

        },
        {
            accessorKey: "overtimeThreshold",
            header: "Порог сверхурочных"
        },
        {
            accessorKey: "overtimeRate",
            header: "Сверхурочная ставка",
            Cell: ({row}) => row.original.overtimeRate && `${row.original.overtimeRate.toLocaleString("ru")}₽`

        }
    ], []);
}