import React, { useState } from 'react'; import { analyzeIssueApi, AIAnalysisResponse } from '../services/api'; interface GuidedIntakeModalProps { initialCategory?: string; selectedCity: string; onClose: () => void; onLaunchCase: (aiData: AIAnalysisResponse, rawText: string) => void; } export const GuidedIntakeModal: React.FC = ({ initialCategory = 'rti', selectedCity, onClose, onLaunchCase, }) => { const [selectedModel, setSelectedModel] = useState(initialCategory); const [grievanceText, setGrievanceText] = useState(''); const [attachedFile, setAttachedFile] = useState(null); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const handleProcess = async () => { if (!grievanceText.trim() && !attachedFile) return; setLoading(true); setError(null); try { const result = await analyzeIssueApi( grievanceText || `Document Analysis: ${attachedFile?.name}`, selectedCity, attachedFile || undefined ); onLaunchCase(result, grievanceText || attachedFile?.name || 'New Filing'); onClose(); } catch (err: any) { setError(err?.message || 'Processing failed. Please try again.'); } finally { setLoading(false); } }; return (
{/* Header */}

Create Legal Notice / RTI

Jurisdiction: {selectedCity}

{/* Input 1: Model Selector */}
{[ { id: 'rti', label: 'RTI Request', icon: 'description' }, { id: 'consumer', label: 'Consumer', icon: 'shopping_bag' }, { id: 'tenancy', label: 'Tenancy / Salary', icon: 'home_work' }, ].map((m) => ( ))}
{/* Input 2: Grievance Input */}