import { ShieldCross, ShieldTick } from "iconsax-react";
import { createColumns } from "../components/common/create-col";
import { colConfig } from "../types";
import { formatDateToPersian } from "./getDate";

const columnConfigs: colConfig[] | [] = [
    {
        accessor: "status", header: "وضعیت",
        cellRenderer: (info) => info.getValue() === 1 ? <ShieldTick color="#11212D" className="flex w-full" /> : <ShieldCross color="#E51717" className="flex w-full" />
    },
    {
        accessor: "deviceId.dollarProfit", header: "دلار"
    },
    { accessor: "deviceId.score", header: "امتیاز" },
    { accessor: "deviceId.model", header: "مدل دستگاه" },
    { accessor: "deviceId.IMEI", header: "شماره IMEI" },
    { accessor: "deviceId.created_at", header: "تاریخ نصب", cellRenderer: (info) => info.getValue() && <p style={{ direction: "ltr" }}>{formatDateToPersian(info.getValue())}</p> },
    { accessor: "registerDate", header: "تاریخ ثبت IMEI", cellRenderer: (info) => info.getValue() && <p style={{ direction: "ltr" }}>{formatDateToPersian(info.getValue())}</p> },
];

export const installationReportsCol = createColumns<any>(columnConfigs);