import type { SpecificationHistory } from "@/features/specification/lib/mock";
import { formatPrice } from "@/shared/lib/formatPrice";
import type { ColumnDef } from "@tanstack/react-table";

export const specificationColumns: ColumnDef<SpecificationHistory>[] = [
  {
    accessorKey: "id",
    header: () => <div className="text-center">№</div>,
    cell: ({ row }) => {
      return <div className="text-center">{row.index + 1}</div>;
    },
  },
  {
    accessorKey: "date",
    header: () => <div className="text-center">Sanasi</div>,
    cell: ({ row }) => {
      return <div className="text-center font-medium">{row.original.date}</div>;
    },
  },
  {
    accessorKey: "pharmacy",
    header: () => <div className="text-center">Farmasevtika</div>,
    cell: ({ row }) => {
      return <div className="text-center">{row.original.pharmacy}</div>;
    },
  },
  {
    accessorKey: "totalAmount",
    header: () => <div className="text-center">Hisoblangan narxi</div>,
    cell: ({ row }) => {
      return (
        <div className="text-center">
          {formatPrice(row.original.totalAmount)}
        </div>
      );
    },
  },
  {
    accessorKey: "paymentPercentage",
    header: () => <div className="text-center">{"To'langan foizi"}</div>,
    cell: ({ row }) => {
      return (
        <div className="text-center">
          {formatPrice(row.original.paymentPercentage)}%
        </div>
      );
    },
  },
  {
    accessorKey: "paymentAmount",
    header: () => <div className="text-center">{"To'langan narxi"}</div>,
    cell: ({ row }) => {
      return (
        <div className="text-center">
          {formatPrice(row.original.paymentAmount)}
        </div>
      );
    },
  },
];
