import { ActionIcon, Group } from '@mantine/core';
import { IconEdit, IconTrash } from '@tabler/icons-react';
import type { TFunction } from 'i18next';
import type { AdvancedColumn } from '@ema-platform/ui';
import type { Certification } from '../../types/certification';

export function certificationActionsColumn(
  t: TFunction,
  handlers: {
    onEdit: (cert: Certification) => void;
    onDelete: (cert: Certification) => void;
  },
): AdvancedColumn<Certification> {
  return {
    header: '',
    label: t('certification.columns.actions', 'Actions'),
    size: 90,
    cell: ({ row }) => (
      <Group gap="xs">
        <ActionIcon variant="subtle" color="blue" size="sm" onClick={() => handlers.onEdit(row.original)}>
          <IconEdit size={14} />
        </ActionIcon>
        <ActionIcon variant="subtle" color="red" size="sm" onClick={() => handlers.onDelete(row.original)}>
          <IconTrash size={14} />
        </ActionIcon>
      </Group>
    ),
  };
}
