import { ColumnDef } from "@tanstack/react-table"
import { ProjectAvlItem } from "./project-avl-table"
import { Checkbox } from "@/components/ui/checkbox"


// 프로젝트 AVL 테이블 컬럼
export const getProjectAvlColumns = (): ColumnDef<ProjectAvlItem>[] => [
    {
        id: "select",
        header: ({ table }) => (
            <Checkbox
                checked={
                    table.getIsAllPageRowsSelected() ||
                    (table.getIsSomePageRowsSelected() && "indeterminate")
                }
                onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
                aria-label="Select all"
            />
        ),
        cell: ({ row }) => (
            <Checkbox
                checked={row.getIsSelected()}
                onCheckedChange={(value) => row.toggleSelected(!!value)}
                aria-label="Select row"
            />
        ),
        enableSorting: false,
        enableHiding: false,
        size: 50,
    },
    {
        accessorKey: "no",
        header: "No.",
        size: 60,
        cell: ({ row }) => {
            return (
                <span>
                    {row.original.no}
                </span>
            )
        },
    },
    {
        accessorKey: "disciplineName",
        header: "설계공종",
        size: 120,
        cell: ({ row }) => {
            return (
                <span>
                    {row.original.disciplineName}
                </span>
            )
        },
    },
    {
        accessorKey: "materialNameCustomerSide",
        header: "고객사 AVL 자재명",
        size: 150,
        cell: ({ row }) => {
            return (
                <span>
                    {row.original.materialNameCustomerSide}
                </span>
            )
        },
    },
    {
        accessorKey: "materialGroupCode",
        header: "자재그룹 코드",
        size: 120,
        cell: ({ row }) => {
            return (
                <span>
                    {row.original.materialGroupCode}
                </span>
            )
        },
    },
    {
        accessorKey: "materialGroupName",
        header: "자재그룹 명",
        size: 130,
        cell: ({ row }) => {
            return (
                <span>
                    {row.original.materialGroupName}
                </span>
            )
        },
    },
    {
        accessorKey: "avlVendorName",
        header: "AVL 등재업체명",
        size: 140,
        cell: ({ row }) => {
            return (
                <span>
                    {row.original.avlVendorName}
                </span>
            )
        },
    },
    {
        accessorKey: "vendorCode",
        header: "협력업체 코드",
        size: 120,
        cell: ({ row }) => {
            return (
                <span>
                    {row.original.vendorCode}
                </span>
            )
        },
    },
    {
        accessorKey: "vendorName",
        header: "협력업체 명",
        size: 130,
        cell: ({ row }) => {
            return (
                <span>
                    {row.original.vendorName}
                </span>
            )
        },
    },
    {
        accessorKey: "ownerSuggestion",
        header: "선주제안",
        size: 100,
        cell: ({ row }) => {
            return (
                <span>
                    {row.original.ownerSuggestion ? "예" : "아니오"}
                </span>
            )
        },
    },
    {
        accessorKey: "shiSuggestion",
        header: "SHI 제안",
        size: 100,
        cell: ({ row }) => {
            return (
                <span>
                    {row.original.shiSuggestion ? "예" : "아니오"}
                </span>
            )
        },
    },
]