export interface Source {
  code: string
  url: string
  source_type: string
  regulation_type: string
  has_data: boolean
  requirement_count: number
}

export interface ScraperStatus {
  status: 'idle' | 'running' | 'completed' | 'error'
  current_source: string | null
  last_error: string | null
  stats: {
    sources_processed: number
    requirements_extracted: number
    errors: number
    last_run: string | null
  }
  known_sources: string[]
}

export interface ScrapeResult {
  code: string
  status: string
  requirements_extracted?: number
  reason?: string
  error?: string
}

export interface PDFDocument {
  code: string
  name: string
  description: string
  expected_aspects: string
  available: boolean
}

export interface PDFExtractionResult {
  success: boolean
  source_document: string
  total_aspects: number
  requirements_created: number
  statistics: {
    by_category: Record<string, number>
    by_requirement_level: Record<string, number>
  }
}

export const BACKEND_URL = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'

export const sourceTypeBadge: Record<string, { label: string; color: string }> = {
  eur_lex: { label: 'EUR-Lex', color: 'bg-blue-100 text-blue-800' },
  bsi_pdf: { label: 'BSI PDF', color: 'bg-green-100 text-green-800' },
  gesetze_im_internet: { label: 'Gesetze', color: 'bg-yellow-100 text-yellow-800' },
  manual: { label: 'Manuell', color: 'bg-gray-100 text-gray-800' },
}

export const regulationTypeBadge: Record<string, { label: string; color: string; icon: string }> = {
  eu_regulation: { label: 'EU-Verordnung', color: 'bg-indigo-100 text-indigo-800', icon: '🇪🇺' },
  eu_directive: { label: 'EU-Richtlinie', color: 'bg-purple-100 text-purple-800', icon: '📜' },
  de_law: { label: 'DE-Gesetz', color: 'bg-yellow-100 text-yellow-800', icon: '🇩🇪' },
  bsi_standard: { label: 'BSI-Standard', color: 'bg-green-100 text-green-800', icon: '🔒' },
  industry_standard: { label: 'Standard', color: 'bg-gray-100 text-gray-800', icon: '📋' },
}
