from __future__ import annotations from typing import Literal from pydantic import BaseModel class ConfigField(BaseModel): env_name: str label: str value: str secret: bool input_type: str configured: bool class ConfigSection(BaseModel): name: str fields: list[ConfigField] class ConfigResponse(BaseModel): sections: list[ConfigSection] class ConfigUpdateRequest(BaseModel): """Flat mapping of env_name → value, mirroring the existing form semantics.""" updates: dict[str, str] class ConfigUpdateResponse(BaseModel): sections: list[ConfigSection] class SmtpTestResponse(BaseModel): """Response from POST /api/config/smtp/test.""" result: Literal["success", "config-error", "failed"] message: str