'use client' import React, { useState } from 'react' import { DSFA, DSFAConsultationRequirement, DSFA_AUTHORITY_RESOURCES, getFederalStateOptions, getAuthorityResource, } from '@/lib/sdk/dsfa/types' interface Art36WarningProps { dsfa: DSFA onUpdate: (data: Record) => Promise isSubmitting: boolean } export function Art36Warning({ dsfa, onUpdate, isSubmitting }: Art36WarningProps) { const isHighResidualRisk = dsfa.residual_risk_level === 'high' || dsfa.residual_risk_level === 'very_high' const consultationReq = dsfa.consultation_requirement const [federalState, setFederalState] = useState(dsfa.federal_state || '') const [authorityNotified, setAuthorityNotified] = useState(consultationReq?.authority_notified || false) const [notificationDate, setNotificationDate] = useState(consultationReq?.notification_date || '') const [waitingPeriodObserved, setWaitingPeriodObserved] = useState(consultationReq?.waiting_period_observed || false) const [authorityResponse, setAuthorityResponse] = useState(consultationReq?.authority_response || '') const [recommendations, setRecommendations] = useState(consultationReq?.authority_recommendations || []) const [newRecommendation, setNewRecommendation] = useState('') const federalStateOptions = getFederalStateOptions() const selectedAuthority = federalState ? getAuthorityResource(federalState) : null const handleSave = async () => { const requirement: DSFAConsultationRequirement = { high_residual_risk: isHighResidualRisk, consultation_required: isHighResidualRisk, consultation_reason: isHighResidualRisk ? 'Trotz geplanter Massnahmen verbleibt ein hohes Restrisiko. Gem. Art. 36 Abs. 1 DSGVO ist vor der Verarbeitung die Aufsichtsbehoerde zu konsultieren.' : undefined, authority_notified: authorityNotified, notification_date: notificationDate || undefined, authority_response: authorityResponse || undefined, authority_recommendations: recommendations.length > 0 ? recommendations : undefined, waiting_period_observed: waitingPeriodObserved, } await onUpdate({ consultation_requirement: requirement, federal_state: federalState, authority_resource_id: federalState, }) } const addRecommendation = () => { if (newRecommendation.trim()) { setRecommendations([...recommendations, newRecommendation.trim()]) setNewRecommendation('') } } const removeRecommendation = (index: number) => { setRecommendations(recommendations.filter((_, i) => i !== index)) } // Don't show if residual risk is not high if (!isHighResidualRisk) { return (

Keine Behoerdenkonsultation erforderlich

Das Restrisiko nach Umsetzung der geplanten Massnahmen ist nicht hoch. Eine vorherige Konsultation der Aufsichtsbehoerde gem. Art. 36 DSGVO ist nicht erforderlich.

) } return (
{/* Warning Banner */}

Behoerdenkonsultation erforderlich (Art. 36 DSGVO)

Das Restrisiko nach Umsetzung aller geplanten Massnahmen wurde als {dsfa.residual_risk_level === 'very_high' ? 'SEHR HOCH' : 'HOCH'} eingestuft.

Gemaess Art. 36 Abs. 1 DSGVO muessen Sie vor Beginn der Verarbeitung die zustaendige Aufsichtsbehoerde konsultieren. Die Behoerde hat eine Frist von 8 Wochen zur Stellungnahme (Art. 36 Abs. 2 DSGVO).

{/* Federal State Selection */}

Zustaendige Aufsichtsbehoerde

{/* Authority Details */} {selectedAuthority && (
{selectedAuthority.name}

({selectedAuthority.shortName})

DSFA-Informationen {selectedAuthority.publicSectorListUrl && ( Muss-Liste (oeffentlich) )} {selectedAuthority.privateSectorListUrl && ( Muss-Liste (nicht-oeffentlich) )} {selectedAuthority.templateUrl && ( DSFA-Vorlage )}
{selectedAuthority.additionalResources && selectedAuthority.additionalResources.length > 0 && (

Weitere Ressourcen:

{selectedAuthority.additionalResources.map((resource, idx) => ( {resource.title} ))}
)}
)}
{/* Consultation Documentation */}

Konsultation dokumentieren

{/* Authority Notified Checkbox */} {authorityNotified && ( <> {/* Notification Date */}
setNotificationDate(e.target.value)} className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500" />
{/* 8-Week Waiting Period */} {/* Authority Response */}