"use client";

import { ColumnDef } from "@tanstack/react-table";
import { DetailDwgReceiptItem } from "../actions";

export const detailDrawingColumns: ColumnDef<DetailDwgReceiptItem>[] = [
  {
    accessorKey: "RegisterSerialNo",
    header: "일련번호",
    minSize: 80,
    cell: ({ row }) => {
      return <div className="text-center">{row.getValue("RegisterSerialNo")}</div>;
    },
  },
  {
    accessorKey: "DrawingRevNo",
    header: "Revision",
    minSize: 100,
    cell: ({ row }) => {
      return <div className="font-medium">{row.getValue("DrawingRevNo")}</div>;
    },
  },
  {
    accessorKey: "Status",
    header: "상태",
    minSize: 120,
    cell: ({ row }) => {
      return <div className="text-center">{row.getValue("Status")}</div>;
    },
  },
  {
    accessorKey: "CategoryENM",
    header: "카테고리",
    minSize: 120,
    cell: ({ row }) => {
      const categoryENM = row.getValue("CategoryENM") as string;
      const categoryNM = row.original.CategoryNM;
      return <div>{categoryENM || categoryNM}</div>;
    },
  },
  {
    accessorKey: "DrawingUsageENM",
    header: "도면용도",
    minSize: 100,
    cell: ({ row }) => {
      const usageENM = row.getValue("DrawingUsageENM") as string | null;
      const usageNM = row.original.DrawingUsageNM;
      return <div>{usageENM || usageNM}</div>;
    },
  },
  {
    accessorKey: "RegisterKindENM",
    header: "등록종류",
    minSize: 180,
    cell: ({ row }) => {
      const kindENM = row.getValue("RegisterKindENM") as string | null;
      const kindNM = row.original.RegisterKindNM;
      return <div>{kindENM || kindNM}</div>;
    },
  },
  {
    accessorKey: "CreateUserNM",
    header: "생성자",
    minSize: 150,
    cell: ({ row }) => {
      const userENM = row.original.CreateUserENM;
      const userNM = row.getValue("CreateUserNM") as string;
      return <div>{userENM || userNM}</div>;
    },
  },
  {
    accessorKey: "CreateDt",
    header: "생성일시",
    minSize: 200,
    cell: ({ row }) => {
      return <div className="text-sm text-muted-foreground">{row.getValue("CreateDt")}</div>;
    },
  },
];

