import { AlertTriangle, Heart, Shield } from 'lucide-react';
import type { LucideIcon } from 'lucide-react';

/**
 * Static per-`tag` card style (icon + gradient) for safety protocols. The tag is
 * DB data on each `policy_documents` row; this map is frontend config keyed by
 * the lowercased tag, with a default fallback.
 */
export interface SafetyTagStyle {
  readonly icon: LucideIcon;
  readonly color: string;
}

export const SAFETY_TAG_STYLES: Record<string, SafetyTagStyle> = {
  fire: { icon: AlertTriangle, color: 'from-orange-400 to-red-500' },
  lockdown: { icon: Shield, color: 'from-blue-400 to-blue-600' },
  shield: { icon: Shield, color: 'from-blue-400 to-blue-600' },
  medical: { icon: Heart, color: 'from-emerald-400 to-emerald-600' },
  heart: { icon: Heart, color: 'from-emerald-400 to-emerald-600' },
};

export const DEFAULT_SAFETY_STYLE: SafetyTagStyle = {
  icon: AlertTriangle,
  color: 'from-violet-400 to-violet-600',
};

export function safetyStyleForTag(tag: string | null): SafetyTagStyle {
  return (tag && SAFETY_TAG_STYLES[tag.toLowerCase()]) || DEFAULT_SAFETY_STYLE;
}

/** Selectable category tags offered by the authoring form (drive the card icon). */
export interface SafetyTagOption {
  readonly value: string;
  readonly label: string;
}

export const SAFETY_PROTOCOL_TAG_OPTIONS: readonly SafetyTagOption[] = [
  { value: 'fire', label: 'Fire / Evacuation' },
  { value: 'lockdown', label: 'Lockdown' },
  { value: 'medical', label: 'Medical' },
  { value: 'general', label: 'General' },
];

export const SAFETY_PROTOCOL_DEFAULT_TAG = SAFETY_PROTOCOL_TAG_OPTIONS[0].value;
