"""Request and response schemas for POST /ai/explain."""

from __future__ import annotations

from pydantic import BaseModel


class ExplainRequest(BaseModel):
    """
    Request body for POST /ai/explain.
    """

    trace_id: str
    source_code: str
    optimized_code: str
    original_profiler_results: str | None = None
    optimized_profiler_results: str | None = None
    original_runtime: str | None = None
    optimized_runtime: str | None = None
    speedup: str | None = None
    annotated_tests: str | None = None
    dependency_code: str | None = None
    optimization_id: str | None = None
    original_explanation: str | None = None
    python_version: str | None = None
    function_references: str | None = None
    acceptance_reason: str | None = None
    codeflash_version: str | None = None
    call_sequence: int | None = None
    original_throughput: int | None = None
    optimized_throughput: int | None = None
    original_concurrency_ratio: float | None = None
    optimized_concurrency_ratio: float | None = None


class ExplainResponse(BaseModel):
    """
    Successful response from POST /ai/explain.
    """

    explanation: str


class ExplainErrorResponse(BaseModel):
    """
    Error response from POST /ai/explain.
    """

    error: str
