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

export const useActiveShiftsTableColumns = () => {
    return useMemo<MRT_ColumnDef<ActiveWorkShiftSchema>[]>(
        () => [
            {
                header: "Начало смены",
                accessorKey: "startedAt",
                Cell: ({ row }) =>
                    new Date(row.original.startedAt).toLocaleString("ru-RU"),
            },
            {
                header: "ФИО",
                Cell: ({ row }) =>
                    `${row.original.user.firstName} ${row.original.user.secondName}`,
            },
            {
                header: "Роль",
                accessorKey: "user.role.name",
                enableSorting: false,
            },
            {
                header: "Должность",
                accessorKey: "user.position.name",
                enableSorting: false,
            }
        ],
        []
    );
};
