export interface Document {
  id: string
  type: string
  name: string
  description: string
  mandatory: boolean
  created_at: string
  updated_at: string
}

export interface Version {
  id: string
  document_id: string
  version: string
  language: string
  title: string
  content: string
  summary?: string
  status:
    | 'draft'
    | 'review' // backward-compat (alte Daten, vor 5-Stage Migration 148)
    | 'review_internal'
    | 'review_client'
    | 'approved'
    | 'published'
    | 'archived'
    | 'rejected'
  created_at: string
  updated_at?: string
  created_by?: string
  approved_by?: string
  approved_at?: string
  rejection_reason?: string
}

export interface ApprovalHistoryItem {
  action: string
  approver: string
  comment: string
  created_at: string
}

export const STATUS_LABELS: Record<string, { label: string; color: string }> = {
  draft: { label: 'Entwurf', color: 'bg-yellow-100 text-yellow-700' },
  review: { label: 'In Pruefung', color: 'bg-blue-100 text-blue-700' },
  review_internal: { label: 'DSB-Pruefung', color: 'bg-blue-100 text-blue-700' },
  review_client: { label: 'Mandant-Pruefung', color: 'bg-indigo-100 text-indigo-700' },
  approved: { label: 'Freigegeben', color: 'bg-green-100 text-green-700' },
  published: { label: 'Veroeffentlicht', color: 'bg-emerald-100 text-emerald-700' },
  archived: { label: 'Archiviert', color: 'bg-slate-100 text-slate-700' },
  rejected: { label: 'Abgelehnt', color: 'bg-red-100 text-red-700' },
}

export const DOCUMENT_TYPES: Record<string, string> = {
  terms: 'AGB',
  privacy: 'Datenschutzerklaerung',
  cookies: 'Cookie-Richtlinie',
  community_guidelines: 'Community-Richtlinien',
  imprint: 'Impressum',
}
