// =============================================================================
// TOM Document — Types, Defaults & Label Constants
// =============================================================================

import type { ControlCategory } from '../tom-generator/types'
import type { TOMComplianceIssueSeverity } from '../tom-compliance'

export interface TOMDocumentOrgHeader {
  organizationName: string
  industry: string
  dpoName: string
  dpoContact: string
  responsiblePerson: string
  itSecurityContact: string
  locations: string[]
  employeeCount: string
  documentVersion: string
  lastReviewDate: string
  nextReviewDate: string
  reviewInterval: string
}

export interface TOMDocumentRevision {
  version: string
  date: string
  author: string
  changes: string
}

export function createDefaultTOMDocumentOrgHeader(): TOMDocumentOrgHeader {
  const now = new Date()
  const nextYear = new Date()
  nextYear.setFullYear(nextYear.getFullYear() + 1)

  return {
    organizationName: '',
    industry: '',
    dpoName: '',
    dpoContact: '',
    responsiblePerson: '',
    itSecurityContact: '',
    locations: [],
    employeeCount: '',
    documentVersion: '1.0',
    lastReviewDate: now.toISOString().split('T')[0],
    nextReviewDate: nextYear.toISOString().split('T')[0],
    reviewInterval: 'Jaehrlich',
  }
}

export const SEVERITY_LABELS_DE: Record<TOMComplianceIssueSeverity, string> = {
  CRITICAL: 'Kritisch',
  HIGH: 'Hoch',
  MEDIUM: 'Mittel',
  LOW: 'Niedrig',
}

export const SEVERITY_COLORS: Record<TOMComplianceIssueSeverity, string> = {
  CRITICAL: '#dc2626',
  HIGH: '#ea580c',
  MEDIUM: '#d97706',
  LOW: '#6b7280',
}

export const CATEGORY_LABELS_DE: Record<ControlCategory, string> = {
  ACCESS_CONTROL: 'Zutrittskontrolle',
  ADMISSION_CONTROL: 'Zugangskontrolle',
  ACCESS_AUTHORIZATION: 'Zugriffskontrolle',
  TRANSFER_CONTROL: 'Weitergabekontrolle',
  INPUT_CONTROL: 'Eingabekontrolle',
  ORDER_CONTROL: 'Auftragskontrolle',
  AVAILABILITY: 'Verfuegbarkeit',
  SEPARATION: 'Trennbarkeit',
  ENCRYPTION: 'Verschluesselung',
  PSEUDONYMIZATION: 'Pseudonymisierung',
  RESILIENCE: 'Belastbarkeit',
  RECOVERY: 'Wiederherstellbarkeit',
  REVIEW: 'Ueberpruefung & Bewertung',
}

export const STATUS_LABELS_DE: Record<string, string> = {
  IMPLEMENTED: 'Umgesetzt',
  PARTIAL: 'Teilweise umgesetzt',
  NOT_IMPLEMENTED: 'Nicht umgesetzt',
}

export const STATUS_BADGE_CLASSES: Record<string, string> = {
  IMPLEMENTED: 'badge-active',
  PARTIAL: 'badge-review',
  NOT_IMPLEMENTED: 'badge-critical',
}

export const APPLICABILITY_LABELS_DE: Record<string, string> = {
  REQUIRED: 'Erforderlich',
  RECOMMENDED: 'Empfohlen',
  OPTIONAL: 'Optional',
  NOT_APPLICABLE: 'Nicht anwendbar',
}
