# generated by datamodel-codegen:
#   filename:  openapi.yaml
#   timestamp: 2025-10-08T12:50:40+00:00

from __future__ import annotations

from datetime import date
from enum import Enum
from typing import Annotated, Any, Optional, Union

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


class CRS(Enum):
    http___www_opengis_net_def_crs_OGC_1_3_CRS84 = (
        "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
    )
    http___www_opengis_net_def_crs_OGC_0_CRS84h = (
        "http://www.opengis.net/def/crs/OGC/0/CRS84h"
    )


class ApiError(BaseModel):
    """
    API error based on RFC 7807
    """

    model_config = ConfigDict(
        extra="allow",
    )
    type: str
    title: Optional[str] = None
    status: Optional[int] = None
    detail: Optional[str] = None
    instance: Optional[str] = None
    traceback: Optional[list[str]] = None


class MaxOccurs(Enum):
    unbounded = "unbounded"


class Link(BaseModel):
    href: str
    rel: Optional[str] = Field(None, examples=["service"])
    type: Optional[str] = Field(None, examples=["application/json"])
    hreflang: Optional[str] = Field(None, examples=["en"])
    title: Optional[str] = None


class Bbox(BaseModel):
    bbox: list[float] = Field(..., max_length=4, min_length=4)
    crs: Optional[CRS] = CRS.http___www_opengis_net_def_crs_OGC_1_3_CRS84


class DataType(Enum):
    array = "array"
    boolean = "boolean"
    integer = "integer"
    number = "number"
    object = "object"
    string = "string"


class Metadata(BaseModel):
    title: Optional[str] = None
    role: Optional[str] = None
    href: Optional[str] = None


class AdditionalParameter(BaseModel):
    name: str
    value: list[Union[str, float, int, list[dict[str, Any]], dict[str, Any]]]


class TransmissionMode(Enum):
    value = "value"
    reference = "reference"


class Capabilities(BaseModel):
    title: Optional[str] = Field(None, examples=["Example processing server"])
    description: Optional[str] = Field(
        None,
        examples=["Example server implementing the OGC API - Processes 1.0 Standard"],
    )
    links: list[Link]


class ConformanceDeclaration(BaseModel):
    conformsTo: list[str]


class ResponseType(Enum):
    raw = "raw"
    document = "document"


class Subscriber(BaseModel):
    """
    Optional URIs for callbacks for this job.

    Support for this parameter is not required and the parameter may be
    removed from the API definition, if conformance class **'callback'**
    is not listed in the conformance declaration under `/conformance`.
    """

    successUri: Optional[AnyUrl] = None
    inProgressUri: Optional[AnyUrl] = None
    failedUri: Optional[AnyUrl] = None


class JobStatus(Enum):
    accepted = "accepted"
    running = "running"
    successful = "successful"
    failed = "failed"
    dismissed = "dismissed"


class JobType(Enum):
    process = "process"


class JobControlOptions(Enum):
    sync_execute = "sync-execute"
    async_execute = "async-execute"
    dismiss = "dismiss"


class JobInfo(BaseModel):
    processID: Optional[str] = None
    type: JobType
    jobID: str
    status: JobStatus
    message: Optional[str] = None
    created: Optional[AwareDatetime] = None
    started: Optional[AwareDatetime] = None
    finished: Optional[AwareDatetime] = None
    updated: Optional[AwareDatetime] = None
    progress: Annotated[Optional[int], Field(None, ge=0, le=100)] = None
    links: Optional[list[Link]] = None
    traceback: Optional[list[str]] = None


class InlineValue(
    RootModel[
        Union[
            Any,
            bool,
            bytes,
            AnyUrl,
            date,
            AwareDatetime,
            str,
            int,
            float,
            list,
            dict[str, Any],
            Bbox,
        ]
    ]
):
    root: Union[
        Any,
        bool,
        bytes,
        AnyUrl,
        date,
        AwareDatetime,
        str,
        int,
        float,
        list,
        dict[str, Any],
        Bbox,
    ]


class AdditionalParameters(Metadata):
    parameters: Optional[list[AdditionalParameter]] = None


class DescriptionType(BaseModel):
    title: Optional[str] = None
    description: Optional[str] = None
    keywords: Optional[list[str]] = None
    metadata: Optional[list[Metadata]] = None
    additionalParameters: Optional[AdditionalParameters] = None


class ProcessSummary(DescriptionType):
    id: str
    version: str
    jobControlOptions: Optional[list[JobControlOptions]] = None
    outputTransmission: Optional[list[TransmissionMode]] = None
    links: Optional[list[Link]] = None


class JobList(BaseModel):
    jobs: list[JobInfo]
    links: list[Link]


class ProcessList(BaseModel):
    processes: list[ProcessSummary]
    links: list[Link]


class Format(BaseModel):
    mediaType: Optional[str] = None
    encoding: Optional[str] = None
    schema_: Optional[Union[AnyUrl, Schema]] = Field(None, alias="schema")


# TODO - Code has been manually moved here after class Format,
#  because it was wrongly placed last by the datamodel-code-generator tool
#  That's why we also use the tool with keep_model_order=False - which is by
#  the way also a bug, as it does the opposite of what it should.
#  See https://github.com/koxudaxi/datamodel-code-generator/issues/2508
#  PLEASE MAKE SURE YOU INCLUDE THIS COMMENT AS LONG AS THE PROBLEM PERSISTS.
class QualifiedValue(Format):
    value: InlineValue


class InlineOrRefValue(RootModel[Union[InlineValue, QualifiedValue, Link]]):
    root: Union[InlineValue, QualifiedValue, Link]


class Discriminator(BaseModel):
    propertyName: Optional[str] = Field(None, min_length=1)
    mapping: Optional[dict[str, Schema]] = None


class Schema(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    field_ref: Optional[str] = Field(None, alias="$ref")
    title: Optional[str] = None
    multipleOf: Optional[float] = Field(None, gt=0.0)
    maximum: Optional[float] = None
    exclusiveMaximum: Optional[bool] = False
    minimum: Optional[float] = None
    exclusiveMinimum: Optional[bool] = False
    maxLength: Optional[int] = Field(None, ge=0)
    minLength: Optional[int] = Field(0, ge=0)
    pattern: Optional[str] = None
    maxItems: Optional[int] = Field(None, ge=0)
    minItems: Optional[int] = Field(0, ge=0)
    uniqueItems: Optional[bool] = False
    maxProperties: Optional[int] = Field(None, ge=0)
    minProperties: Optional[int] = Field(0, ge=0)
    required: Optional[list[str]] = Field(None, min_length=1)
    enum: Optional[list] = Field(None, min_length=1)
    type: Optional[DataType] = None
    not_: Optional[Schema] = Field(None, alias="not")
    allOf: Optional[list[Schema]] = None
    oneOf: Optional[list[Schema]] = None
    anyOf: Optional[list[Schema]] = None
    discriminator: Optional[Discriminator] = None
    items: Optional[Union[list[Schema], Schema]] = None
    properties: Optional[dict[str, Schema]] = None
    additionalProperties: Optional[Union[Schema, bool]] = True
    description: Optional[str] = None
    format: Optional[str] = None
    default: Optional[Any] = None
    nullable: Optional[bool] = False
    readOnly: Optional[bool] = False
    writeOnly: Optional[bool] = False
    example: Optional[Any] = None
    examples: Optional[Any] = None
    deprecated: Optional[bool] = False
    contentMediaType: Optional[str] = None
    contentEncoding: Optional[str] = None
    contentSchema: Optional[str] = None


class ProcessDescription(ProcessSummary):
    inputs: Optional[dict[str, InputDescription]] = None
    outputs: Optional[dict[str, OutputDescription]] = None


class ProcessRequest(BaseModel):
    inputs: Optional[dict[str, Any]] = None
    outputs: Optional[dict[str, Output]] = None
    response: Optional[ResponseType] = ResponseType.raw
    subscriber: Optional[Subscriber] = None


class InputDescription(DescriptionType):
    minOccurs: Optional[int] = 1
    maxOccurs: Optional[Union[int, MaxOccurs]] = None
    schema_: Schema = Field(..., alias="schema")


class OutputDescription(DescriptionType):
    schema_: Schema = Field(..., alias="schema")


class Output(BaseModel):
    format: Optional[Format] = None
    transmissionMode: Optional[TransmissionMode] = TransmissionMode.value


class JobResults(RootModel[Optional[dict[str, InlineOrRefValue]]]):
    root: Optional[dict[str, InlineOrRefValue]] = None


Format.model_rebuild()
InlineOrRefValue.model_rebuild()
Discriminator.model_rebuild()
ProcessDescription.model_rebuild()
ProcessRequest.model_rebuild()
QualifiedValue.model_rebuild()
