"""
Wizard API - Request/Response Models.
"""

from typing import Optional, List, Dict, Any
from pydantic import BaseModel, Field


class WizardState(BaseModel):
    """Aktueller Wizard-Status."""
    subscription_id: Optional[str] = None
    current_step: int = 0  # 0=nicht gestartet, 1-3=Schritte, 4=abgeschlossen
    is_completed: bool = False
    step_data: Dict[str, Any] = {}
    recommended_templates: List[Dict[str, Any]] = []


class Step1Data(BaseModel):
    """Daten für Schritt 1: Rollenwahl."""
    role: str = Field(..., description="lehrkraft, schulleitung, it_beauftragte")


class Step2Data(BaseModel):
    """Daten für Schritt 2: Template-Auswahl."""
    template_ids: List[str] = Field(..., min_length=1, max_length=3)


class Step3Data(BaseModel):
    """Daten für Schritt 3: Bestätigung."""
    notification_email: Optional[str] = None
    digest_enabled: bool = True
    digest_frequency: str = "weekly"


class StepResponse(BaseModel):
    """Response für Schritt-Update."""
    status: str
    current_step: int
    next_step: int
    message: str
    recommended_templates: List[Dict[str, Any]] = []


class MigrateEmailRequest(BaseModel):
    """Request für E-Mail-Migration."""
    original_label: Optional[str] = Field(default=None, description="Beschreibung des Alerts")


class MigrateEmailResponse(BaseModel):
    """Response für E-Mail-Migration."""
    status: str
    inbound_address: str
    instructions: List[str]
    source_id: str


class MigrateRssRequest(BaseModel):
    """Request für RSS-Import."""
    rss_urls: List[str] = Field(..., min_length=1, max_length=20)
    labels: Optional[List[str]] = None


class MigrateRssResponse(BaseModel):
    """Response für RSS-Import."""
    status: str
    sources_created: int
    topics_created: int
    message: str
