# Copyright 2026 UCP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# generated by datamodel-codegen
# pylint: disable=all
# pyformat: disable

from __future__ import annotations

from typing import Any, Literal

from pydantic import AnyUrl, BaseModel, ConfigDict, Field, RootModel


class UcpService(RootModel[Any]):
    model_config = ConfigDict(
        frozen=True,
    )
    root: Any = Field(..., title="UCP Service")
    """
    Service binding for a specific transport. Each transport binding is a separate entry in the service array.
    """


class Config(BaseModel):
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    delegate: list[str] | None = None
    """
    Delegations the business allows. At service-level, declares available delegations. In checkout responses, confirms accepted delegations for this session.
    """


class Version(RootModel[Any]):
    model_config = ConfigDict(
        frozen=True,
    )
    root: Any


class Base(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl | None = None
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl | None = Field(None, alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: dict[str, Any] | None = None
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["rest", "mcp", "a2a", "embedded"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl | None = None
    """
    Endpoint URL for this transport binding.
    """


class PlatformSchema(BaseModel):
    """
    Full service declaration for platform-level discovery. Different transports require different fields.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl = Field(..., alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: dict[str, Any] | None = None
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["rest"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl
    """
    Endpoint URL for this transport binding.
    """


class PlatformSchema5(BaseModel):
    """
    Full service declaration for platform-level discovery. Different transports require different fields.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl = Field(..., alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: dict[str, Any] | None = None
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["mcp"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl
    """
    Endpoint URL for this transport binding.
    """


class PlatformSchema6(BaseModel):
    """
    Full service declaration for platform-level discovery. Different transports require different fields.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl | None = Field(None, alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: dict[str, Any] | None = None
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["a2a"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl
    """
    Endpoint URL for this transport binding.
    """


class PlatformSchema7(BaseModel):
    """
    Full service declaration for platform-level discovery. Different transports require different fields.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl = Field(..., alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: dict[str, Any] | None = None
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["embedded"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl | None = None
    """
    Endpoint URL for this transport binding.
    """


class PlatformSchema3(
    RootModel[
        PlatformSchema | PlatformSchema5 | PlatformSchema6 | PlatformSchema7
    ]
):
    model_config = ConfigDict(
        frozen=True,
    )
    root: (
        PlatformSchema | PlatformSchema5 | PlatformSchema6 | PlatformSchema7
    ) = Field(..., title="Service (Platform Schema)")
    """
    Full service declaration for platform-level discovery. Different transports require different fields.
    """


class BusinessSchema(BaseModel):
    """
    Service binding for business/merchant configuration. May override platform endpoints.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl | None = None
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl | None = Field(None, alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: dict[str, Any] | None = None
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["rest"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl
    """
    Endpoint URL for this transport binding.
    """


class BusinessSchema4(BaseModel):
    """
    Service binding for business/merchant configuration. May override platform endpoints.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl | None = None
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl | None = Field(None, alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: dict[str, Any] | None = None
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["mcp"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl
    """
    Endpoint URL for this transport binding.
    """


class BusinessSchema5(BaseModel):
    """
    Service binding for business/merchant configuration. May override platform endpoints.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl | None = None
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl | None = Field(None, alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: dict[str, Any] | None = None
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["a2a"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl
    """
    Endpoint URL for this transport binding.
    """


class BusinessSchema6(BaseModel):
    """
    Service binding for business/merchant configuration. May override platform endpoints.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl | None = None
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl | None = Field(None, alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: Config | None = Field(None, title="Embedded Transport Config")
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["embedded"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl | None = None
    """
    Endpoint URL for this transport binding.
    """


class BusinessSchema2(
    RootModel[
        BusinessSchema | BusinessSchema4 | BusinessSchema5 | BusinessSchema6
    ]
):
    model_config = ConfigDict(
        frozen=True,
    )
    root: (
        BusinessSchema | BusinessSchema4 | BusinessSchema5 | BusinessSchema6
    ) = Field(..., title="Service (Business Schema)")
    """
    Service binding for business/merchant configuration. May override platform endpoints.
    """


class ResponseSchema(BaseModel):
    """
    Service binding in API responses. Includes per-resource transport configuration via typed config.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl | None = None
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl | None = Field(None, alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: dict[str, Any] | None = None
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["rest"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl | None = None
    """
    Endpoint URL for this transport binding.
    """


class ResponseSchema4(BaseModel):
    """
    Service binding in API responses. Includes per-resource transport configuration via typed config.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl | None = None
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl | None = Field(None, alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: dict[str, Any] | None = None
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["mcp"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl | None = None
    """
    Endpoint URL for this transport binding.
    """


class ResponseSchema5(BaseModel):
    """
    Service binding in API responses. Includes per-resource transport configuration via typed config.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl | None = None
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl | None = Field(None, alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: dict[str, Any] | None = None
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["a2a"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl | None = None
    """
    Endpoint URL for this transport binding.
    """


class ResponseSchema6(BaseModel):
    """
    Service binding in API responses. Includes per-resource transport configuration via typed config.
    """

    model_config = ConfigDict(
        extra="allow",
    )
    version: Version
    """
    Entity version in YYYY-MM-DD format.
    """
    spec: AnyUrl | None = None
    """
    URL to human-readable specification document.
    """
    schema_: AnyUrl | None = Field(None, alias="schema")
    """
    URL to JSON Schema defining this entity's structure and payloads.
    """
    id: str | None = None
    """
    Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
    """
    config: Config | None = Field(None, title="Embedded Transport Config")
    """
    Entity-specific configuration. Structure defined by each entity's schema.
    """
    transport: Literal["embedded"]
    """
    Transport protocol for this service binding.
    """
    endpoint: AnyUrl | None = None
    """
    Endpoint URL for this transport binding.
    """


class ResponseSchema2(
    RootModel[
        ResponseSchema | ResponseSchema4 | ResponseSchema5 | ResponseSchema6
    ]
):
    model_config = ConfigDict(
        frozen=True,
    )
    root: (
        ResponseSchema | ResponseSchema4 | ResponseSchema5 | ResponseSchema6
    ) = Field(..., title="Service (Response Schema)")
    """
    Service binding in API responses. Includes per-resource transport configuration via typed config.
    """
