import { ColumnDef } from "@tanstack/react-table";
import { TransactionHistoryRecord } from "../../../../hooks/features/dashboard/useTransacationHistoryFetch";
import { convertDateStringToDate } from "../../../../utils/helper";
import { TransactionStatusBadge } from "../transactions/components/TransactionStatusBadge";

export const transactionHistoryColumns: ColumnDef<TransactionHistoryRecord>[] =
  [
    {
      accessorKey: "createdAt",
      header: "Purchase Date",
      enableSorting: true,
      cell: ({ row }) => (
        <span className="">
          {convertDateStringToDate(row.original.createdAt)}
        </span>
      ),
    },

    {
      accessorKey: "packageName",
      header: "Package Purchased",
      cell: ({ row }) => <span className="">{row.original.packageName}</span>,
    },

    {
      accessorKey: "amount",
      header: "Amount Paid",
      cell: ({ row }) => <span className="">${row.original.amount}</span>,
    },

    {
      accessorKey: "credits",
      header: "Credits Received",
      cell: ({ row }) => <span className="">{row.original.credits}</span>,
    },

    {
      accessorKey: "status",
      header: "Payment Status",
      cell: ({ row }) => (
        <TransactionStatusBadge status={row.original.status} />
      ),
    },
  ];
