# 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

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


class PaymentHandler(RootModel[Any]):
    model_config = ConfigDict(
        frozen=True,
    )
    root: Any = Field(..., title="Payment Handler")
    """
    Schema for UCP payment handlers. Handlers define how payment instruments are processed.
    """


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
    """
    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.
    """


class PlatformSchema(BaseModel):
    """
    Platform declaration for discovery profiles. May include partial config state required for discovery.
    """

    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
    """
    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.
    """


class BusinessSchema(BaseModel):
    """
    Business declaration for discovery profiles. May include partial config state required for discovery.
    """

    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
    """
    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.
    """


class ResponseSchema(BaseModel):
    """
    Handler reference in responses. May include full config state for runtime usage of the handler.
    """

    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
    """
    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.
    """
