import { useMemo } from "react";
import { DataTableColumn } from "mantine-datatable";
import { StatusHistorySchema } from "@/lib/client";
import { utcDateTimeToLocalString } from "@/utils/datetime";

export const useDealStatusHistoryTableColumns = () => {
    return useMemo(
        () =>
            [
                {
                    accessor: "createdAt",
                    title: "Дата",
                    render: row =>
                        utcDateTimeToLocalString(new Date(row.createdAt)),
                },
                // {
                //     title: "Пользователь",
                //     cell: row => `${row.user.firstName} ${row.user.secondName}`,
                // },
                {
                    accessor: "fromStatus.name",
                    title: "Из статуса",
                },
                {
                    accessor: "toStatus.name",
                    title: "В статус",
                },
            ] as DataTableColumn<StatusHistorySchema>[],
        []
    );
};
