# generated by datamodel-codegen:
#   filename:  a2a_spec_fixed.json

from __future__ import annotations

from datetime import datetime
from enum import Enum
from typing import Annotated, Any, Dict, List, Literal, Union

from pydantic import BaseModel, ConfigDict, Field, RootModel


class A2AProtocolSchema(RootModel[Any]):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    root: Annotated[Any, Field(title='A2A Protocol Schema')]
    """
    JSON Schema for A2A Protocol
    """


class AgentAuthentication(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    schemes: Annotated[List[str], Field(title='Schemes')]
    credentials: Annotated[Any | None, Field(title='Credentials')] = None


class AgentCapabilities(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    streaming: Annotated[bool | None, Field(title='Streaming')] = False
    push_notifications: Annotated[
        bool | None, Field(alias='pushNotifications', title='PushNotifications')
    ] = False
    state_transition_history: Annotated[
        bool | None,
        Field(alias='stateTransitionHistory', title='Statetransitionhistory'),
    ] = False


class AgentProvider(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    organization: Annotated[str, Field(title='Organization')]
    url: Annotated[Any | None, Field(title='Url')] = None


class AgentSkill(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    id: Annotated[str, Field(title='Id')]
    name: Annotated[str, Field(title='Name')]
    description: Annotated[Any | None, Field(title='Description')] = None
    tags: Annotated[Any | None, Field(title='Tags')] = None
    examples: Annotated[Any | None, Field(title='Examples')] = None
    input_modes: Annotated[Any | None, Field(alias='inputModes', title='Inputmodes')] = None
    output_modes: Annotated[Any | None, Field(alias='outputModes', title='Outputmodes')] = (
        None
    )


class AuthenticationInfo(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    schemes: Annotated[List[str], Field(title='Schemes')]
    credentials: Annotated[Any | None, Field(title='Credentials')] = None


class PushNotificationNotSupportedError(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    code: Annotated[Literal[-32003], Field(examples=[-32003], title='Code')]
    """
    Error code
    """
    message: Annotated[
        Literal['Push Notification is not supported'],
        Field(examples=['Push Notification is not supported'], title='Message'),
    ]
    """
    A short description of the error
    """
    data: Annotated[Any | None, Field(title='Data')]


class CancelTaskResponse(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    result: None = None
    error: None = None


class DataPart(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    type: Annotated[Literal['data'], Field(examples=['data'], title='Type')]
    """
    Type of the part
    """
    data: Annotated[Dict[str, Any], Field(title='Data')]
    metadata: Annotated[Any | None, Field(title='Metadata')] = None


class FileContent(BaseModel):
    """
    Represents the content of a file, either as base64 encoded bytes or a URI.

    Ensures that either 'bytes' or 'uri' is provided, but not both.
    """

    model_config = ConfigDict(
        populate_by_name=True,
    )
    name: Annotated[Any | None, Field(title='Name')] = None
    mime_type: Annotated[Any | None, Field(alias='mimeType', title='Mimetype')] = None
    bytes: Annotated[Any | None, Field(title='Bytes')] = None
    uri: Annotated[Any | None, Field(title='Uri')] = None


class FilePart(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    type: Annotated[Literal['file'], Field(examples=['file'], title='Type')]
    """
    Type of the part
    """
    file: FileContent
    metadata: Annotated[Any | None, Field(title='Metadata')] = None


class GetTaskPushNotificationResponse(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    result: None = None
    error: None = None


class GetTaskResponse(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    result: None = None
    error: None = None


class InternalError(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    code: Annotated[Literal[-32603], Field(examples=[-32603], title='Code')]
    """
    Error code
    """
    message: Annotated[
        Literal['Internal error'], Field(examples=['Internal error'], title='Message')
    ]
    """
    A short description of the error
    """
    data: Annotated[Any | None, Field(title='Data')] = None


class InvalidParamsError(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    code: Annotated[Literal[-32602], Field(examples=[-32602], title='Code')]
    """
    Error code
    """
    message: Annotated[
        Literal['Invalid parameters'],
        Field(examples=['Invalid parameters'], title='Message'),
    ]
    """
    A short description of the error
    """
    data: Annotated[Any | None, Field(title='Data')] = None


class InvalidRequestError(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    code: Annotated[Literal[-32600], Field(examples=[-32600], title='Code')]
    """
    Error code
    """
    message: Annotated[
        Literal['Request payload validation error'],
        Field(examples=['Request payload validation error'], title='Message'),
    ]
    """
    A short description of the error
    """
    data: Annotated[Any | None, Field(title='Data')] = None


class JSONParseError(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    code: Annotated[Literal[-32700], Field(examples=[-32700], title='Code')]
    """
    Error code
    """
    message: Annotated[
        Literal['Invalid JSON payload'],
        Field(examples=['Invalid JSON payload'], title='Message'),
    ]
    """
    A short description of the error
    """
    data: Annotated[Any | None, Field(title='Data')] = None


class JSONRPCError(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    code: Annotated[int, Field(title='Code')]
    message: Annotated[str, Field(title='Message')]
    data: Annotated[Any | None, Field(title='Data')] = None


class JSONRPCMessage(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None


class JSONRPCRequest(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    method: Annotated[str, Field(title='Method')]
    params: Annotated[Any | None, Field(title='Params')] = None


class JSONRPCResponse(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    result: Annotated[Any | None, Field(title='Result')] = None
    error: None = None


class Role(Enum):
    user = 'user'
    agent = 'agent'


class MethodNotFoundError(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    code: Annotated[Literal[-32601], Field(examples=[-32601], title='Code')]
    """
    Error code
    """
    message: Annotated[
        Literal['Method not found'],
        Field(examples=['Method not found'], title='Message'),
    ]
    """
    A short description of the error
    """
    data: Annotated[Any | None, Field(title='Data')]


class PushNotificationConfig(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    url: Annotated[str, Field(title='Url')]
    token: Annotated[Any | None, Field(title='Token')] = None
    authentication: None = None


class Part(RootModel[None]):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    root: Annotated[Any | None, Field(title='Part')]


class SendTaskResponse(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    result: None = None
    error: None = None


class SendTaskStreamingResponse(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    result: None = None
    error: None = None


class SetTaskPushNotificationResponse(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    result: None = None
    error: None = None


class TaskPushNotificationConfig(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    id: Annotated[str, Field(title='Id')]
    push_notification_config: Annotated[
        PushNotificationConfig, Field(alias='pushNotificationConfig')
    ]

    @property
    def pushNotificationConfig(self) -> PushNotificationConfig:
        """
        Provide alias-style attribute access so tests can do:
            conf.pushNotificationConfig.url
        """
        return self.push_notification_config


class TaskNotCancelableError(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    code: Annotated[Literal[-32002], Field(examples=[-32002], title='Code')]
    """
    Error code
    """
    message: Annotated[
        Literal['Task cannot be canceled'],
        Field(examples=['Task cannot be canceled'], title='Message'),
    ]
    """
    A short description of the error
    """
    data: Annotated[Any | None, Field(title='Data')]


class TaskNotFoundError(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    code: Annotated[Literal[-32001], Field(examples=[-32001], title='Code')]
    """
    Error code
    """
    message: Annotated[
        Literal['Task not found'], Field(examples=['Task not found'], title='Message')
    ]
    """
    A short description of the error
    """
    data: Annotated[Any | None, Field(title='Data')]


class TaskIdParams(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    id: Annotated[str, Field(title='Id')]
    metadata: Annotated[Any | None, Field(title='Metadata')] = None


class TaskQueryParams(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    id: Annotated[str, Field(title='Id')]
    history_length: Annotated[Any | None, Field(alias='historyLength', title='HistoryLength')
    ] = None
    metadata: Annotated[Any | None, Field(title='Metadata')] = None


class TaskState(Enum):
    """
    An enumeration.
    """

    submitted = 'submitted'
    working = 'working'
    input_required = 'input-required'
    completed = 'completed'
    canceled = 'canceled'
    failed = 'failed'
    unknown = 'unknown'


class TaskStatus(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    state: TaskState
    message: None = None
    timestamp: Annotated[datetime | None, Field(title='Timestamp')] = None


class TaskResubscriptionRequest(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    method: Annotated[Literal['tasks/resubscribe'], Field(title='Method')]
    params: TaskQueryParams


class TaskStatusUpdateEvent(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    id: Annotated[str, Field(title='Id')]
    status: TaskStatus
    final: Annotated[bool | None, Field(title='Final')] = False
    metadata: Annotated[Any | None, Field(title='Metadata')] = None


class TextPart(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    type: Annotated[Literal['text'], Field(examples=['text'], title='Type')]
    """
    Type of the part
    """
    text: Annotated[str, Field(title='Text')]
    metadata: Annotated[Any | None, Field(title='Metadata')] = None


class UnsupportedOperationError(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    code: Annotated[Literal[-32004], Field(examples=[-32004], title='Code')]
    """
    Error code
    """
    message: Annotated[
        Literal['This operation is not supported'],
        Field(examples=['This operation is not supported'], title='Message'),
    ]
    """
    A short description of the error
    """
    data: Annotated[Any | None, Field(title='Data')]


class A2ARequest(RootModel[None]):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    root: Annotated[Any | None, Field(title='A2ARequest')]


class AgentCard(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    name: Annotated[str, Field(title='Name')]
    description: Annotated[Any | None, Field(title='Description')] = None
    url: Annotated[str, Field(title='Url')]
    provider: None = None
    version: Annotated[str, Field(title='Version')]
    documentation_url: Annotated[Any | None, Field(alias='documentationUrl', title='Documentationurl')
    ] = None
    capabilities: AgentCapabilities
    authentication: None = None
    default_input_modes: Annotated[
        List[str] | None, Field(alias='defaultInputModes', title='Defaultinputmodes')
    ] = ['text']
    default_output_modes: Annotated[
        List[str] | None, Field(alias='defaultOutputModes', title='Defaultoutputmodes')
    ] = ['text']
    skills: Annotated[List[AgentSkill], Field(title='Skills')]


class Artifact(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    name: Annotated[Any | None, Field(title='Name')] = None
    description: Annotated[Any | None, Field(title='Description')] = None
    parts: Annotated[List[Part], Field(title='Parts')]
    index: Annotated[int | None, Field(title='Index')] = 0
    append: Annotated[Any | None, Field(title='Append')] = None
    last_chunk: Annotated[Any | None, Field(alias='lastChunk', title='LastChunk')] = None
    metadata: Annotated[Any | None, Field(title='Metadata')] = None


class CancelTaskRequest(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    method: Annotated[Literal['tasks/cancel'], Field(title='Method')]
    params: TaskIdParams


class GetTaskPushNotificationRequest(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    method: Annotated[Literal['tasks/pushNotification/get'], Field(title='Method')]
    params: TaskIdParams


class GetTaskRequest(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    method: Annotated[Literal['tasks/get'], Field(title='Method')]
    params: TaskQueryParams


class Message(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    role: Annotated[Role, Field(title='Role')]
    parts: Annotated[List[Part], Field(title='Parts')]
    metadata: Annotated[Any | None, Field(title='Metadata')] = None


class SetTaskPushNotificationRequest(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    method: Annotated[Literal['tasks/pushNotification/set'], Field(title='Method')]
    params: TaskPushNotificationConfig


class Task(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    id: Annotated[str, Field(title='Id')]
    session_id: Annotated[Any | None, Field(alias='sessionId', title='Sessionid')] = None
    status: TaskStatus
    artifacts: Annotated[Any | None, Field(title='Artifacts')] = None
    history: Annotated[Any | None, Field(title='History')] = None
    metadata: Annotated[Any | None, Field(title='Metadata')] = None


class TaskSendParams(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    id: Annotated[str, Field(title='Id')]
    session_id: Annotated[str | None, Field(alias='sessionId', title='Sessionid')] = (
        None
    )
    message: Message
    push_notification: Annotated[Any | None, Field(alias='pushNotification')] = None
    history_length: Annotated[Any | None, Field(alias='historyLength', title='HistoryLength')
    ] = None
    metadata: Annotated[Any | None, Field(title='Metadata')] = None


class TaskArtifactUpdateEvent(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    id: Annotated[str, Field(title='Id')]
    artifact: Artifact
    metadata: Annotated[Any | None, Field(title='Metadata')] = None


class SendTaskRequest(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    method: Annotated[Literal['tasks/send'], Field(title='Method')]
    params: TaskSendParams


class SendTaskStreamingRequest(BaseModel):
    model_config = ConfigDict(
        populate_by_name=True,
    )
    jsonrpc: Annotated[Literal['2.0'], Field(title='Jsonrpc')] = '2.0'
    id: Annotated[Any | None, Field(title='Id')] = None
    method: Annotated[Literal['tasks/sendSubscribe'], Field(title='Method')]
    params: TaskSendParams
