import { ActionIcon, Group } from "@mantine/core";
import { IconEdit, IconTrash } from "@tabler/icons-react";
import type { AdvancedColumn } from "@ema-platform/ui";
import type { Profession } from "../../types/configuration";

export function professionActionsColumn(handlers: {
  onEdit: (prof: Profession) => void;
  onDelete: (prof: Profession) => void;
}): AdvancedColumn<Profession> {
  return {
    header: "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>
    ),
  };
}
