import generated from '@/data/institutional-ux.generated.json';

export interface LegalTrack {
  id: string;
  label: string;
  question: string;
  summary: string;
  href: string;
  status: string;
  statusLabel: string;
}

export interface OnboardingStep {
  step: number;
  title: string;
  description: string;
  href: string;
  cta: string;
}

export interface JurisdictionCard {
  id: string;
  label: string;
  status: string;
  statusLabel: string;
  posture: string;
  matrixHref: string;
  perimeterHref?: string;
}

export interface InstitutionalPortal {
  id: string;
  label: string;
  href: string;
  audience: string;
}

export interface InstitutionalUxData {
  generatedAt: string;
  disclaimer: string;
  legalTracks: LegalTrack[];
  onboardingJourney: OnboardingStep[];
  jurisdictionCards: JurisdictionCard[];
  portals: InstitutionalPortal[];
  prohibitedClaimsPreview: string[];
}

const FALLBACK: InstitutionalUxData = {
  generatedAt: '2026-06-14',
  disclaimer:
    'Informational engineering readiness only — not legal advice, a regulatory determination, or an audit certificate.',
  legalTracks: [],
  onboardingJourney: [],
  jurisdictionCards: [],
  portals: [],
  prohibitedClaimsPreview: [],
};

export const institutionalUx: InstitutionalUxData =
  generated && typeof generated === 'object' && 'legalTracks' in generated
    ? (generated as InstitutionalUxData)
    : FALLBACK;

export function jurisdictionStatusClass(status: string): string {
  if (status === 'pilot_ready') return 'bg-emerald-500/15 text-emerald-300 ring-emerald-500/30';
  if (status === 'draft_started' || status === 'draft') return 'bg-amber-500/15 text-amber-300 ring-amber-500/30';
  return 'bg-gray-500/15 text-gray-300 ring-gray-500/30';
}
