""" Erwartungshorizont Templates — registry for template lookup. """ from typing import Dict, List, Optional from eh_templates_types import EHTemplate, AUFGABENTYPEN from eh_templates_analyse import ( get_textanalyse_template, get_gedichtanalyse_template, get_prosaanalyse_template, get_dramenanalyse_template, ) from eh_templates_eroerterung import get_eroerterung_template TEMPLATES: Dict[str, EHTemplate] = {} def initialize_templates(): """Initialize all pre-defined templates.""" global TEMPLATES TEMPLATES = { "textanalyse_pragmatisch": get_textanalyse_template(), "gedichtanalyse": get_gedichtanalyse_template(), "eroerterung_textgebunden": get_eroerterung_template(), "prosaanalyse": get_prosaanalyse_template(), "dramenanalyse": get_dramenanalyse_template(), } def get_template(aufgabentyp: str) -> Optional[EHTemplate]: """Get a template by Aufgabentyp.""" if not TEMPLATES: initialize_templates() return TEMPLATES.get(aufgabentyp) def list_templates() -> List[Dict]: """List all available templates.""" if not TEMPLATES: initialize_templates() return [ { "aufgabentyp": typ, "name": AUFGABENTYPEN.get(typ, {}).get("name", typ), "description": AUFGABENTYPEN.get(typ, {}).get("description", ""), "category": AUFGABENTYPEN.get(typ, {}).get("category", "other"), } for typ in TEMPLATES.keys() ] def get_aufgabentypen() -> Dict: """Get all Aufgabentypen definitions.""" return AUFGABENTYPEN # Initialize on import initialize_templates()