"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from mesa_sdk.types import BaseModel, Nullable, UNSET_SENTINEL
from mesa_sdk.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata
import pydantic
from pydantic import model_serializer
from typing import Any, Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class GetByOrgByRepoAgentblameRequestTypedDict(TypedDict):
    org: str
    repo: str
    base: str
    head: str


class GetByOrgByRepoAgentblameRequest(BaseModel):
    org: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]

    repo: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]

    base: Annotated[
        str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True))
    ]

    head: Annotated[
        str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True))
    ]


class GetByOrgByRepoAgentblameInternalServerErrorErrorTypedDict(TypedDict):
    code: str
    message: str
    details: NotRequired[Dict[str, Any]]


class GetByOrgByRepoAgentblameInternalServerErrorError(BaseModel):
    code: str

    message: str

    details: Optional[Dict[str, Any]] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["details"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


class GetByOrgByRepoAgentblameConflictErrorTypedDict(TypedDict):
    code: str
    message: str
    details: NotRequired[Dict[str, Any]]


class GetByOrgByRepoAgentblameConflictError(BaseModel):
    code: str

    message: str

    details: Optional[Dict[str, Any]] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["details"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


class GetByOrgByRepoAgentblameNotAcceptableErrorTypedDict(TypedDict):
    code: str
    message: str
    details: NotRequired[Dict[str, Any]]


class GetByOrgByRepoAgentblameNotAcceptableError(BaseModel):
    code: str

    message: str

    details: Optional[Dict[str, Any]] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["details"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


class GetByOrgByRepoAgentblameNotFoundErrorTypedDict(TypedDict):
    code: str
    message: str
    details: NotRequired[Dict[str, Any]]


class GetByOrgByRepoAgentblameNotFoundError(BaseModel):
    code: str

    message: str

    details: Optional[Dict[str, Any]] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["details"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


class GetByOrgByRepoAgentblameForbiddenErrorTypedDict(TypedDict):
    code: str
    message: str
    details: NotRequired[Dict[str, Any]]


class GetByOrgByRepoAgentblameForbiddenError(BaseModel):
    code: str

    message: str

    details: Optional[Dict[str, Any]] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["details"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


class GetByOrgByRepoAgentblameUnauthorizedErrorTypedDict(TypedDict):
    code: str
    message: str
    details: NotRequired[Dict[str, Any]]


class GetByOrgByRepoAgentblameUnauthorizedError(BaseModel):
    code: str

    message: str

    details: Optional[Dict[str, Any]] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["details"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


class GetByOrgByRepoAgentblameBadRequestErrorTypedDict(TypedDict):
    code: str
    message: str
    details: NotRequired[Dict[str, Any]]


class GetByOrgByRepoAgentblameBadRequestError(BaseModel):
    code: str

    message: str

    details: Optional[Dict[str, Any]] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["details"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


class AttributionTypedDict(TypedDict):
    line_number: float
    provider: str
    model: Nullable[str]
    confidence: float
    match_type: str


class Attribution(BaseModel):
    line_number: Annotated[float, pydantic.Field(alias="lineNumber")]

    provider: str

    model: Nullable[str]

    confidence: float

    match_type: str

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                m[k] = val

        return m


class GetByOrgByRepoAgentblameStatsTypedDict(TypedDict):
    total_lines: float
    ai_lines: float
    human_lines: float
    ai_percentage: float


class GetByOrgByRepoAgentblameStats(BaseModel):
    total_lines: float

    ai_lines: float

    human_lines: float

    ai_percentage: float


class GetByOrgByRepoAgentblameResponseTypedDict(TypedDict):
    r"""Attribution data"""

    attributions: Dict[str, List[AttributionTypedDict]]
    stats: GetByOrgByRepoAgentblameStatsTypedDict


class GetByOrgByRepoAgentblameResponse(BaseModel):
    r"""Attribution data"""

    attributions: Dict[str, List[Attribution]]

    stats: GetByOrgByRepoAgentblameStats
