"""Error response models."""

from typing import Any

from pydantic import BaseModel, Field


class ErrorResponse(BaseModel):
    """RFC7807 Problem+JSON error response"""

    type: str = Field(..., description="Error type URI")
    title: str = Field(..., description="Error title")
    status: int = Field(..., description="HTTP status code")
    detail: str = Field(..., description="Error detail")
    instance: str = Field(..., description="Error instance URI")
    trace_id: str | None = Field(None, description="Trace identifier")


class ValidationError(BaseModel):
    """Validation error details"""

    field: str = Field(..., description="Field name")
    message: str = Field(..., description="Error message")
    value: Any = Field(..., description="Invalid value")


class ValidationErrorResponse(ErrorResponse):
    """Validation error response with field details"""

    errors: list[ValidationError] = Field(..., description="Validation errors")
