'use client' import React from 'react' import { LoeschfristPolicy, LegalHold, StorageLocation, RETENTION_DRIVER_META, RetentionDriverType, DeletionMethodType, DELETION_METHOD_LABELS, STORAGE_LOCATION_LABELS, StorageLocationType, RetentionUnit, LegalHoldStatus, } from '@/lib/sdk/loeschfristen-types' import { renderTriggerBadge } from './UebersichtTab' // --------------------------------------------------------------------------- // Shared type (canonical home; EditorSections re-exports this) // --------------------------------------------------------------------------- export type SetFn = (key: K, val: LoeschfristPolicy[K]) => void // --------------------------------------------------------------------------- // Sektion 2: 3-stufige Loeschlogik // --------------------------------------------------------------------------- export function DeletionLogicSection({ policy, pid, set, updateLegalHoldItem, addLegalHold, removeLegalHold, }: { policy: LoeschfristPolicy; pid: string; set: SetFn updateLegalHoldItem: (idx: number, updater: (h: LegalHold) => LegalHold) => void addLegalHold: (policyId: string) => void removeLegalHold: (policyId: string, idx: number) => void }) { return (

2. 3-stufige Loeschlogik

{(['PURPOSE_END', 'RETENTION_DRIVER', 'LEGAL_HOLD'] as const).map((trigger) => ( ))}
{policy.deletionTrigger === 'RETENTION_DRIVER' && (
)}
set('retentionDuration', parseInt(e.target.value) || 0)} className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500" />
set('retentionDescription', e.target.value)} placeholder="z.B. Handelsrechtliche Aufbewahrungspflicht gem. HGB" className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500" />
set('startEvent', e.target.value)} placeholder="z.B. Ende des Geschaeftsjahres, Vertragsende..." className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500" />
{/* Legal Holds */}

Legal Holds

{policy.legalHolds.length > 0 && (
{policy.legalHolds.map((hold, idx) => ( ))}
Bezeichnung Grund Status Erstellt am Aktion
updateLegalHoldItem(idx, (h) => ({ ...h, name: e.target.value }))} placeholder="Bezeichnung" className="w-full px-2 py-1 border border-gray-200 rounded text-sm focus:ring-1 focus:ring-purple-500" /> updateLegalHoldItem(idx, (h) => ({ ...h, reason: e.target.value }))} placeholder="Grund" className="w-full px-2 py-1 border border-gray-200 rounded text-sm focus:ring-1 focus:ring-purple-500" /> updateLegalHoldItem(idx, (h) => ({ ...h, createdAt: e.target.value }))} className="px-2 py-1 border border-gray-200 rounded text-sm focus:ring-1 focus:ring-purple-500" />
)}
) } // --------------------------------------------------------------------------- // Sektion 3: Speicherorte & Loeschmethode // --------------------------------------------------------------------------- export function StorageSection({ policy, pid, set, updateStorageLocationItem, addStorageLocation, removeStorageLocation, }: { policy: LoeschfristPolicy; pid: string; set: SetFn updateStorageLocationItem: (idx: number, updater: (s: StorageLocation) => StorageLocation) => void addStorageLocation: (policyId: string) => void removeStorageLocation: (policyId: string, idx: number) => void }) { return (

3. Speicherorte & Loeschmethode

{policy.storageLocations.length > 0 && (
{policy.storageLocations.map((loc, idx) => ( ))}
Name Typ Backup Anbieter Loeschfaehig Aktion
updateStorageLocationItem(idx, (s) => ({ ...s, name: e.target.value }))} placeholder="Name" className="w-full px-2 py-1 border border-gray-200 rounded text-sm focus:ring-1 focus:ring-purple-500" /> updateStorageLocationItem(idx, (s) => ({ ...s, isBackup: e.target.checked }))} className="text-purple-600 focus:ring-purple-500 rounded" /> updateStorageLocationItem(idx, (s) => ({ ...s, provider: e.target.value }))} placeholder="Anbieter" className="w-full px-2 py-1 border border-gray-200 rounded text-sm focus:ring-1 focus:ring-purple-500" /> updateStorageLocationItem(idx, (s) => ({ ...s, deletionCapable: e.target.checked }))} className="text-purple-600 focus:ring-purple-500 rounded" />
)}