"""Pydantic schemas for session resolution outputs."""
from __future__ import annotations
from typing import Any
from uuid import UUID
from datetime import datetime
from pydantic import BaseModel, Field


class ResolutionOutputResponse(BaseModel):
    id: UUID
    session_id: UUID
    output_type: str
    generated_content: str
    structured_data: dict[str, Any] | None
    edited_content: str | None
    status: str
    pushed_to: str | None
    pushed_at: datetime | None
    pushed_reference: str | None
    generated_by_model: str
    created_at: datetime
    updated_at: datetime
    model_config = {"from_attributes": True}


class ResolutionOutputEditRequest(BaseModel):
    edited_content: str = Field(..., min_length=1)


class ResolutionOutputPushRequest(BaseModel):
    destination: str = Field(..., pattern="^(psa|kb_library|clipboard|email)$")


class ResolutionOutputPushResponse(BaseModel):
    output_id: UUID
    status: str
    pushed_to: str
    pushed_reference: str | None = None


class AllResolutionOutputsResponse(BaseModel):
    outputs: list[ResolutionOutputResponse]
