// =============================================================================
// Transfer and Input Controls
// Categories: TRANSFER_CONTROL, INPUT_CONTROL
// =============================================================================

import { ControlLibraryEntry } from '../../types'

export const TRANSFER_INPUT_CONTROLS: ControlLibraryEntry[] = [
  // TRANSFER_CONTROL
  {
    id: 'TOM-TR-01',
    code: 'TOM-TR-01',
    category: 'TRANSFER_CONTROL',
    type: 'TECHNICAL',
    name: { de: 'Transportverschlüsselung (TLS)', en: 'Transport Encryption (TLS)' },
    description: {
      de: 'Verschlüsselung aller Datenübertragungen mittels TLS 1.2 oder höher.',
      en: 'Encryption of all data transfers using TLS 1.2 or higher.',
    },
    mappings: [
      { framework: 'GDPR_ART32', reference: 'Art. 32 Abs. 1 lit. a' },
      { framework: 'ISO27001_ANNEX_A', reference: 'A.13.2.1' },
    ],
    applicabilityConditions: [],
    defaultApplicability: 'REQUIRED',
    evidenceRequirements: ['TLS-Konfigurationsdokumentation', 'SSL/TLS-Scans'],
    reviewFrequency: 'QUARTERLY',
    priority: 'CRITICAL',
    complexity: 'MEDIUM',
    tags: ['encryption', 'transport', 'tls'],
  },
  {
    id: 'TOM-TR-02',
    code: 'TOM-TR-02',
    category: 'TRANSFER_CONTROL',
    type: 'TECHNICAL',
    name: { de: 'VPN für Fernzugriff', en: 'VPN for Remote Access' },
    description: {
      de: 'Nutzung von VPN-Verbindungen für sicheren Fernzugriff auf Unternehmensnetzwerke.',
      en: 'Use of VPN connections for secure remote access to corporate networks.',
    },
    mappings: [
      { framework: 'GDPR_ART32', reference: 'Art. 32 Abs. 1 lit. b' },
      { framework: 'ISO27001_ANNEX_A', reference: 'A.13.2.1' },
    ],
    applicabilityConditions: [
      { field: 'companyProfile.hasRemoteWorkers', operator: 'EQUALS', value: true, result: 'REQUIRED', priority: 25 },
    ],
    defaultApplicability: 'RECOMMENDED',
    evidenceRequirements: ['VPN-Konfiguration', 'Nutzungsrichtlinie'],
    reviewFrequency: 'ANNUAL',
    priority: 'HIGH',
    complexity: 'MEDIUM',
    tags: ['vpn', 'remote-access', 'encryption'],
  },
  {
    id: 'TOM-TR-03',
    code: 'TOM-TR-03',
    category: 'TRANSFER_CONTROL',
    type: 'ORGANIZATIONAL',
    name: { de: 'E-Mail-Verschlüsselung', en: 'Email Encryption' },
    description: {
      de: 'Verschlüsselung sensibler E-Mails mittels S/MIME oder PGP.',
      en: 'Encryption of sensitive emails using S/MIME or PGP.',
    },
    mappings: [
      { framework: 'GDPR_ART32', reference: 'Art. 32 Abs. 1 lit. a' },
      { framework: 'ISO27001_ANNEX_A', reference: 'A.13.2.3' },
    ],
    applicabilityConditions: [
      { field: 'dataProfile.hasSpecialCategories', operator: 'EQUALS', value: true, result: 'REQUIRED', priority: 25 },
    ],
    defaultApplicability: 'RECOMMENDED',
    evidenceRequirements: ['E-Mail-Verschlüsselungsrichtlinie', 'Zertifikatsverwaltung'],
    reviewFrequency: 'ANNUAL',
    priority: 'MEDIUM',
    complexity: 'MEDIUM',
    tags: ['email', 'encryption', 'communication'],
  },
  {
    id: 'TOM-TR-04',
    code: 'TOM-TR-04',
    category: 'TRANSFER_CONTROL',
    type: 'TECHNICAL',
    name: { de: 'Sichere Dateiübertragung (SFTP/FTPS)', en: 'Secure File Transfer (SFTP/FTPS)' },
    description: {
      de: 'Nutzung verschlüsselter Protokolle für Dateiübertragungen (SFTP, FTPS, HTTPS).',
      en: 'Use of encrypted protocols for file transfers (SFTP, FTPS, HTTPS).',
    },
    mappings: [
      { framework: 'GDPR_ART32', reference: 'Art. 32 Abs. 1 lit. a' },
      { framework: 'ISO27001_ANNEX_A', reference: 'A.13.2.1' },
    ],
    applicabilityConditions: [],
    defaultApplicability: 'REQUIRED',
    evidenceRequirements: ['Protokollkonfiguration', 'Übertragungsprotokolle'],
    reviewFrequency: 'ANNUAL',
    priority: 'HIGH',
    complexity: 'LOW',
    tags: ['file-transfer', 'encryption', 'sftp'],
  },
  {
    id: 'TOM-TR-05',
    code: 'TOM-TR-05',
    category: 'TRANSFER_CONTROL',
    type: 'TECHNICAL',
    name: { de: 'Data Loss Prevention (DLP)', en: 'Data Loss Prevention (DLP)' },
    description: {
      de: 'Implementierung von DLP-Lösungen zur Verhinderung der unautorisierten Weitergabe von Daten.',
      en: 'Implementation of DLP solutions to prevent unauthorized data transfer.',
    },
    mappings: [
      { framework: 'GDPR_ART32', reference: 'Art. 32 Abs. 1 lit. b' },
      { framework: 'ISO27001_ANNEX_A', reference: 'A.13.2.1' },
    ],
    applicabilityConditions: [
      { field: 'dataProfile.hasSpecialCategories', operator: 'EQUALS', value: true, result: 'RECOMMENDED', priority: 20 },
      { field: 'riskProfile.protectionLevel', operator: 'IN', value: ['HIGH', 'VERY_HIGH'], result: 'RECOMMENDED', priority: 10 },
    ],
    defaultApplicability: 'OPTIONAL',
    evidenceRequirements: ['DLP-Konfiguration', 'Vorfallsberichte'],
    reviewFrequency: 'QUARTERLY',
    priority: 'HIGH',
    complexity: 'HIGH',
    tags: ['dlp', 'data-protection'],
  },
  {
    id: 'TOM-TR-06',
    code: 'TOM-TR-06',
    category: 'TRANSFER_CONTROL',
    type: 'TECHNICAL',
    name: { de: 'E-Mail-Verschluesselung (erweitert)', en: 'Email Encryption (Extended)' },
    description: {
      de: 'Erweiterte E-Mail-Verschluesselung mit automatischer Erkennung sensibler Inhalte und erzwungener Gateway-Verschluesselung.',
      en: 'Extended email encryption with automatic detection of sensitive content and enforced gateway encryption.',
    },
    mappings: [
      { framework: 'GDPR_ART32', reference: 'Art. 32 Abs. 1 lit. a' },
      { framework: 'ISO27001_ANNEX_A', reference: 'A.13.2.3' },
    ],
    applicabilityConditions: [
      { field: 'dataProfile.hasSpecialCategories', operator: 'EQUALS', value: true, result: 'REQUIRED', priority: 25 },
      { field: 'riskProfile.protectionLevel', operator: 'IN', value: ['HIGH', 'VERY_HIGH'], result: 'RECOMMENDED', priority: 15 },
    ],
    defaultApplicability: 'OPTIONAL',
    evidenceRequirements: ['E-Mail-Verschluesselungs-Policy', 'Gateway-Konfiguration', 'DLP-Regeln'],
    reviewFrequency: 'SEMI_ANNUAL',
    priority: 'MEDIUM',
    complexity: 'MEDIUM',
    tags: ['transfer', 'email', 'encryption'],
  },
  {
    id: 'TOM-TR-07',
    code: 'TOM-TR-07',
    category: 'TRANSFER_CONTROL',
    type: 'ORGANIZATIONAL',
    name: { de: 'Drittstaat-Transferbewertung', en: 'Third Country Transfer Assessment' },
    description: {
      de: 'Dokumentierte Bewertung und Absicherung von Datenuebermittlungen in Drittstaaten gemaess Art. 44-49 DSGVO (Standardvertragsklauseln, TIA).',
      en: 'Documented assessment and safeguarding of data transfers to third countries according to Art. 44-49 GDPR (Standard Contractual Clauses, TIA).',
    },
    mappings: [
      { framework: 'GDPR_ART32', reference: 'Art. 44-49' },
      { framework: 'ISO27001_ANNEX_A', reference: 'A.15.1.2' },
    ],
    applicabilityConditions: [
      { field: 'dataProfile.thirdCountryTransfers', operator: 'EQUALS', value: true, result: 'REQUIRED', priority: 30 },
      { field: 'architectureProfile.hostingLocation', operator: 'IN', value: ['THIRD_COUNTRY_ADEQUATE', 'THIRD_COUNTRY'], result: 'REQUIRED', priority: 25 },
    ],
    defaultApplicability: 'OPTIONAL',
    evidenceRequirements: ['Transfer Impact Assessment', 'Standardvertragsklauseln', 'Angemessenheitsbeschluss-Pruefung'],
    reviewFrequency: 'ANNUAL',
    priority: 'CRITICAL',
    complexity: 'MEDIUM',
    tags: ['transfer', 'third-country', 'schrems-ii'],
  },

  // INPUT_CONTROL
  {
    id: 'TOM-IN-01',
    code: 'TOM-IN-01',
    category: 'INPUT_CONTROL',
    type: 'TECHNICAL',
    name: { de: 'Audit-Logging', en: 'Audit Logging' },
    description: {
      de: 'Umfassende Protokollierung aller Datenverarbeitungsvorgänge mit Zeitstempel und Benutzeridentifikation.',
      en: 'Comprehensive logging of all data processing activities with timestamp and user identification.',
    },
    mappings: [
      { framework: 'GDPR_ART32', reference: 'Art. 32 Abs. 1 lit. b' },
      { framework: 'ISO27001_ANNEX_A', reference: 'A.12.4.1' },
    ],
    applicabilityConditions: [],
    defaultApplicability: 'REQUIRED',
    evidenceRequirements: ['Logging-Konzept', 'Log-Konfiguration', 'Beispiel-Logs'],
    reviewFrequency: 'ANNUAL',
    priority: 'CRITICAL',
    complexity: 'MEDIUM',
    tags: ['logging', 'audit'],
  },
  {
    id: 'TOM-IN-02',
    code: 'TOM-IN-02',
    category: 'INPUT_CONTROL',
    type: 'TECHNICAL',
    name: { de: 'Änderungsprotokollierung (Change Log)', en: 'Change Logging' },
    description: {
      de: 'Automatische Protokollierung aller Änderungen an personenbezogenen Daten.',
      en: 'Automatic logging of all changes to personal data.',
    },
    mappings: [
      { framework: 'GDPR_ART32', reference: 'Art. 32 Abs. 1 lit. b' },
      { framework: 'ISO27001_ANNEX_A', reference: 'A.12.4.1' },
    ],
    applicabilityConditions: [],
    defaultApplicability: 'REQUIRED',
    evidenceRequirements: ['Change-Log-Konfiguration', 'Beispielprotokolle'],
    reviewFrequency: 'ANNUAL',
    priority: 'HIGH',
    complexity: 'MEDIUM',
    tags: ['logging', 'change-tracking'],
  },
  {
    id: 'TOM-IN-03',
    code: 'TOM-IN-03',
    category: 'INPUT_CONTROL',
    type: 'TECHNICAL',
    name: { de: 'Eingabevalidierung', en: 'Input Validation' },
    description: {
      de: 'Technische Validierung aller Eingaben zur Verhinderung von Datenmanipulation und Injection-Angriffen.',
      en: 'Technical validation of all inputs to prevent data manipulation and injection attacks.',
    },
    mappings: [
      { framework: 'GDPR_ART32', reference: 'Art. 32 Abs. 1 lit. b' },
      { framework: 'ISO27001_ANNEX_A', reference: 'A.14.2.5' },
    ],
    applicabilityConditions: [],
    defaultApplicability: 'REQUIRED',
    evidenceRequirements: ['Validierungsregeln', 'Code-Reviews'],
    reviewFrequency: 'QUARTERLY',
    priority: 'HIGH',
    complexity: 'MEDIUM',
    tags: ['security', 'validation'],
  },
  {
    id: 'TOM-IN-04',
    code: 'TOM-IN-04',
    category: 'INPUT_CONTROL',
    type: 'ORGANIZATIONAL',
    name: { de: 'Log-Aufbewahrung und -Auswertung', en: 'Log Retention and Analysis' },
    description: {
      de: 'Definierte Aufbewahrungsfristen für Protokolle und regelmäßige Auswertung zur Erkennung von Anomalien.',
      en: 'Defined retention periods for logs and regular analysis to detect anomalies.',
    },
    mappings: [
      { framework: 'GDPR_ART32', reference: 'Art. 32 Abs. 1 lit. b' },
      { framework: 'ISO27001_ANNEX_A', reference: 'A.12.4.1' },
    ],
    applicabilityConditions: [],
    defaultApplicability: 'REQUIRED',
    evidenceRequirements: ['Log-Aufbewahrungsrichtlinie', 'Analyseberichte'],
    reviewFrequency: 'QUARTERLY',
    priority: 'HIGH',
    complexity: 'MEDIUM',
    tags: ['logging', 'analysis', 'retention'],
  },
  {
    id: 'TOM-IN-05',
    code: 'TOM-IN-05',
    category: 'INPUT_CONTROL',
    type: 'TECHNICAL',
    name: { de: 'Automatisierte Eingabevalidierung', en: 'Automated Input Validation' },
    description: {
      de: 'Technische Validierung aller Benutzereingaben zur Verhinderung von Injection-Angriffen und Sicherstellung der Datenintegritaet.',
      en: 'Technical validation of all user inputs to prevent injection attacks and ensure data integrity.',
    },
    mappings: [
      { framework: 'GDPR_ART32', reference: 'Art. 32 Abs. 1 lit. b' },
      { framework: 'ISO27001_ANNEX_A', reference: 'A.14.2.5' },
    ],
    applicabilityConditions: [],
    defaultApplicability: 'REQUIRED',
    evidenceRequirements: ['Validierungsregeln-Dokumentation', 'Penetrationstest-Berichte'],
    reviewFrequency: 'QUARTERLY',
    priority: 'HIGH',
    complexity: 'MEDIUM',
    tags: ['input-validation', 'security', 'injection-prevention'],
  },
]
