import type { ColumnDef } from '@tanstack/table-core';
import type { ElectronicNotice } from '$lib/api/dashboard/a76/general_catalogs/electronic-notices';
import { renderComponent } from '$lib/components/ui/data-table';
import DataTableActions from './data-table-actions.svelte';
import { Head } from '$lib/components/ui/table';

export function createColumns(onSuccess?: () => void): ColumnDef<ElectronicNotice>[] {
    return [
        {
            accessorKey: 'notice_number',
            header: 'No. Aviso',
            cell: ({ row }) => row.original.notice_number || 'N/A'
        },
        {
            accessorKey: 'year',
            header: 'Año',
            cell: ({ row }) => row.original.year || 'N/A'
        },
        {
            accessorKey: 'patent',
            header: 'Patente',
            cell: ({ row }) => row.original.patent || 'N/A'
        },
        {
            accessorKey: 'pedimento',
            header: 'Pedimento',
            cell: ({ row }) => row.original.pedimento || 'N/A'
        },
        {
            accessorKey: 'status',
            header: 'Estatus',
            cell: ({ row }) => row.original.status || 'N/A'
        },
        {
            id: 'actions',
            Headers: 'Acciones',
            cell: ({ row }) => {
                return renderComponent(DataTableActions, {
                    item: row.original,
                    onSuccess
                });
            }
        }
    ];
}
