"use client";
import { ColumnDef } from "@tanstack/react-table";
import Delete from "@/components/admin/custom ui/Delete";
import Link from "next/link";


export const columns: ColumnDef<CouponsType>[] = [
  {
    accessorKey: "serial",
    header: "#",
    cell: ({ row }) => <p>{row.index + 1}</p>,
  },
  {
    accessorKey: "is_active",
    header: "Active",
    cell: ({ row }) => <p>{row.original.isActive ? "Yes" : "No"}</p>,
  },
  {
    accessorKey: "coupon_code",
    header: "Coupon Code",
    cell: ({ row }) => (
      <Link
        href={`/admin/coupons/${row.original.id}`}
        className="text-primary"
      >
        <p>{row.original.code}</p>
      </Link>
    ),
  },
  {
    accessorKey: "coupon_name",
    header: "Coupon Name",
    cell: ({ row }) => <p>{row.original.code}</p>,
  },
  {
    accessorKey: "discount_type",
    header: "Discount Type",
    cell: ({ row }) => <p>{row.original.type}</p>,
  },
  {
    accessorKey: "discount_amount",
    header: "Discount Amount",
    cell: ({ row }) => <p>{row.original.maxDiscount}</p>,
  },
  {
    accessorKey: "discount_on",
    header: "Discount On",
    cell: ({ row }) => <p>{row.original.minPurchaseAmount}</p>,
  },
  {
    id: "actions",
    cell: ({ row }) => (
      <Delete id={String(row.original.id)} item="coupons" />
    ),
  },
];
