# generated by datamodel-codegen:
#   filename:  get-signals-request.json
#   timestamp: 2025-11-15T22:03:55+00:00

from __future__ import annotations

from enum import Enum
from typing import Annotated, Any

from adcp.types.base import AdCPBaseModel
from pydantic import ConfigDict, Field, RootModel

from . import destination


class Country(RootModel[str]):
    root: Annotated[str, Field(pattern="^[A-Z]{2}$")]


class DeliverTo(AdCPBaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    countries: Annotated[
        list[Country], Field(description="Countries where signals will be used (ISO codes)")
    ]
    destinations: Annotated[
        list[destination.Destination1 | destination.Destination2],
        Field(
            description="List of destination platforms (DSPs, sales agents, etc.). If the authenticated caller matches one of these destinations, activation keys will be included in the response.",
            min_length=1,
        ),
    ]


class CatalogType(Enum):
    marketplace = "marketplace"
    custom = "custom"
    owned = "owned"


class Filters(AdCPBaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    catalog_types: Annotated[
        list[CatalogType] | None, Field(description="Filter by catalog type")
    ] = None
    data_providers: Annotated[
        list[str] | None, Field(description="Filter by specific data providers")
    ] = None
    max_cpm: Annotated[float | None, Field(description="Maximum CPM price filter", ge=0.0)] = None
    min_coverage_percentage: Annotated[
        float | None, Field(description="Minimum coverage requirement", ge=0.0, le=100.0)
    ] = None


class GetSignalsRequest(AdCPBaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    context: Annotated[
        dict[str, Any] | None,
        Field(
            description="Initiator-provided context included in the request payload. Agents must echo this value back unchanged in responses and webhooks. Use for UI/session hints, correlation tokens, or tracking metadata."
        ),
    ] = None
    deliver_to: Annotated[
        DeliverTo, Field(description="Destination platforms where signals need to be activated")
    ]
    filters: Annotated[Filters | None, Field(description="Filters to refine results")] = None
    max_results: Annotated[
        int | None, Field(description="Maximum number of results to return", ge=1)
    ] = None
    signal_spec: Annotated[
        str, Field(description="Natural language description of the desired signals")
    ]
