"""
PDF Models - Dataclasses fuer PDF-Generierung.

Enthaelt alle Datenmodelle die von PDFService und den Convenience-Funktionen
in pdf_service.py verwendet werden.
"""

from dataclasses import dataclass
from typing import Any, Dict, List, Optional


@dataclass
class SchoolInfo:
    """Schulinformationen fuer Header."""
    name: str
    address: str
    phone: str
    email: str
    logo_path: Optional[str] = None
    website: Optional[str] = None
    principal: Optional[str] = None


@dataclass
class LetterData:
    """Daten fuer Elternbrief-PDF."""
    recipient_name: str
    recipient_address: str
    student_name: str
    student_class: str
    subject: str
    content: str
    date: str
    teacher_name: str
    teacher_title: Optional[str] = None
    school_info: Optional[SchoolInfo] = None
    letter_type: str = "general"  # general, halbjahr, fehlzeiten, elternabend, lob
    tone: str = "professional"
    legal_references: Optional[List[Dict[str, str]]] = None
    gfk_principles_applied: Optional[List[str]] = None


@dataclass
class CertificateData:
    """Daten fuer Zeugnis-PDF."""
    student_name: str
    student_birthdate: str
    student_class: str
    school_year: str
    certificate_type: str  # halbjahr, jahres, abschluss
    subjects: List[Dict[str, Any]]  # [{name, grade, note}]
    attendance: Dict[str, int]  # {days_absent, days_excused, days_unexcused}
    remarks: Optional[str] = None
    class_teacher: str = ""
    principal: str = ""
    school_info: Optional[SchoolInfo] = None
    issue_date: str = ""
    social_behavior: Optional[str] = None  # A, B, C, D
    work_behavior: Optional[str] = None  # A, B, C, D


@dataclass
class StudentInfo:
    """Schuelerinformationen fuer Korrektur-PDFs."""
    student_id: str
    name: str
    class_name: str


@dataclass
class CorrectionData:
    """Daten fuer Korrektur-Uebersicht PDF."""
    student: StudentInfo
    exam_title: str
    subject: str
    date: str
    max_points: int
    achieved_points: int
    grade: str
    percentage: float
    corrections: List[Dict[str, Any]]  # [{question, answer, points, feedback}]
    teacher_notes: str = ""
    ai_feedback: str = ""
    grade_distribution: Optional[Dict[str, int]] = None  # {note: anzahl}
    class_average: Optional[float] = None
