'use client';

import type { IamAuditAction } from '@/services/api/iam-admin';

const COLORS: Record<IamAuditAction, string> = {
  CREATE: 'bg-blue-100 text-blue-700',
  UPDATE: 'bg-amber-100 text-amber-700',
  DELETE: 'bg-red-100 text-red-700',
  ADMIN_BYPASS: 'bg-gray-200 text-gray-700',
};

export function ActionBadge({ action }: { action: IamAuditAction | string }) {
  const cls = COLORS[action as IamAuditAction] ?? 'bg-gray-100 text-gray-700';
  return (
    <span className={`inline-block px-2 py-0.5 rounded text-xs font-medium ${cls}`}>
      {action}
    </span>
  );
}
