"use client";
import { ColumnDef } from "@tanstack/react-table";
import Delete from "@/components/admin/custom ui/Delete";
import Link from "next/link";
import Image from "next/image";

export const columns: ColumnDef<ProductType>[] = [
  {
    accessorKey: "serial",
    header: "#",
    cell: ({ row }) => <p>{row.index + 1}</p>,
  },
  {
    accessorKey: "title",
    header: "Product Name",
    cell: ({ row }) => (
      <Link
        href={`/admin/products/${row.original.id}`}
        className="text-primary"
      >
        <p>{row.original.product_name}</p>
      </Link>
    ),
  },

  {
    accessorKey: "category",
    header: "Category",
    cell: ({ row }) => <p>{row.original.category?.name}</p>,
  },
  {
    accessorKey: "subCategory",
    header: "Sub_Category",
    cell: ({ row }) => <p>{row.original.sub_category?.name}</p>,
  },


  {
    id: "actions",
    cell: ({ row }) => <Delete id={row?.original?.id} item="products" />,
  },
];
