"""AI-enhanced report response schemas."""

from datetime import datetime

from pydantic import BaseModel, Field, field_validator


class ReportExportRequest(BaseModel):
    """Optional payload for report generation/export endpoints."""

    engagement_id: int | None = Field(default=None, ge=1)
    include_vault: bool = False
    include_ai: bool | None = None
    vault_query: str | None = Field(default=None, max_length=600)

    @field_validator("vault_query")
    @classmethod
    def _normalize_query(cls, value: str | None) -> str | None:
        if value is None:
            return None
        text = value.strip()
        return text or None


class ReportExportRead(BaseModel):
    """Structured markdown export response."""

    engagement_id: int
    generated_at: datetime
    report_markdown: str
