# generated by datamodel-codegen:
#   filename:  signals/get_signals_request.json
#   timestamp: 2026-02-12T02:11:19+00:00

from __future__ import annotations

from typing import Annotated

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

from ..core import context as context_1
from ..core import destination
from ..core import ext as ext_1
from ..core import pagination_request, signal_filters, signal_id


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


class DeliverTo(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    countries: Annotated[
        list[Country],
        Field(description='Countries where signals will be used (ISO codes)', min_length=1),
    ]
    deployments: Annotated[
        list[destination.Destination],
        Field(
            description='List of deployment targets (DSPs, sales agents, etc.). If the authenticated caller matches one of these deployment targets, activation keys will be included in the response.',
            min_length=1,
        ),
    ]


class DeliverTo1(DeliverTo):
    pass


class GetSignalsRequest1(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    context: context_1.ContextObject | None = None
    deliver_to: Annotated[
        DeliverTo, Field(description='Deployment targets where signals need to be activated')
    ]
    ext: ext_1.ExtensionObject | None = None
    filters: signal_filters.SignalFilters | None = None
    max_results: Annotated[
        int | None, Field(description='Maximum number of results to return', ge=1)
    ] = None
    pagination: pagination_request.PaginationRequest | None = None
    signal_ids: Annotated[
        list[signal_id.SignalId] | None,
        Field(
            description="Specific signals to look up by data provider and ID. Returns exact matches from the data provider's catalog. Takes precedence over signal_spec when both are provided.",
            min_length=1,
        ),
    ] = None
    signal_spec: Annotated[
        str,
        Field(
            description='Natural language description of the desired signals. When used alone, enables semantic discovery. When combined with signal_ids, provides context for the agent but signal_ids matches are returned first.'
        ),
    ]


class GetSignalsRequest2(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    context: context_1.ContextObject | None = None
    deliver_to: Annotated[
        DeliverTo1, Field(description='Deployment targets where signals need to be activated')
    ]
    ext: ext_1.ExtensionObject | None = None
    filters: signal_filters.SignalFilters | None = None
    max_results: Annotated[
        int | None, Field(description='Maximum number of results to return', ge=1)
    ] = None
    pagination: pagination_request.PaginationRequest | None = None
    signal_ids: Annotated[
        list[signal_id.SignalId],
        Field(
            description="Specific signals to look up by data provider and ID. Returns exact matches from the data provider's catalog. Takes precedence over signal_spec when both are provided.",
            min_length=1,
        ),
    ]
    signal_spec: Annotated[
        str | None,
        Field(
            description='Natural language description of the desired signals. When used alone, enables semantic discovery. When combined with signal_ids, provides context for the agent but signal_ids matches are returned first.'
        ),
    ] = None


class GetSignalsRequest(RootModel[GetSignalsRequest1 | GetSignalsRequest2]):
    root: Annotated[
        GetSignalsRequest1 | GetSignalsRequest2,
        Field(
            description='Request parameters for discovering signals. Use signal_spec for natural language discovery, signal_ids for exact lookups, or both (signal_ids take precedence for exact matches, signal_spec provides additional discovery context).',
            title='Get Signals Request',
        ),
    ]
