# generated by datamodel-codegen:
#   filename:  core/data_provider_signal_selector.json
#   timestamp: 2026-02-23T01:56:40+00:00

from __future__ import annotations

from typing import Annotated, Literal

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


class DataProviderSignalSelector1(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    data_provider_domain: Annotated[
        str,
        Field(
            description="Domain where data provider's adagents.json is hosted (e.g., 'polk.com')",
            pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
        ),
    ]
    selection_type: Annotated[
        Literal['all'],
        Field(
            description='Discriminator indicating all signals from this data provider are included'
        ),
    ]


class SignalId(RootModel[str]):
    root: Annotated[str, Field(pattern='^[a-zA-Z0-9_-]+$')]


class DataProviderSignalSelector2(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    data_provider_domain: Annotated[
        str,
        Field(
            description="Domain where data provider's adagents.json is hosted (e.g., 'polk.com')",
            pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
        ),
    ]
    selection_type: Annotated[
        Literal['by_id'],
        Field(description='Discriminator indicating selection by specific signal IDs'),
    ]
    signal_ids: Annotated[
        list[SignalId],
        Field(description="Specific signal IDs from the data provider's catalog", min_length=1),
    ]


class SignalTag(RootModel[str]):
    root: Annotated[str, Field(pattern='^[a-z0-9_-]+$')]


class DataProviderSignalSelector3(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    data_provider_domain: Annotated[
        str,
        Field(
            description="Domain where data provider's adagents.json is hosted (e.g., 'polk.com')",
            pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
        ),
    ]
    selection_type: Annotated[
        Literal['by_tag'], Field(description='Discriminator indicating selection by signal tags')
    ]
    signal_tags: Annotated[
        list[SignalTag],
        Field(
            description="Signal tags from the data provider's catalog. Selector covers all signals with these tags",
            min_length=1,
        ),
    ]


class DataProviderSignalSelector(
    RootModel[
        DataProviderSignalSelector1 | DataProviderSignalSelector2 | DataProviderSignalSelector3
    ]
):
    root: Annotated[
        DataProviderSignalSelector1 | DataProviderSignalSelector2 | DataProviderSignalSelector3,
        Field(
            description="Selects signals from a data provider's adagents.json catalog. Used for product definitions and agent authorization. Supports three selection patterns: all signals, specific IDs, or by tags.",
            discriminator='selection_type',
            title='Data Provider Signal Selector',
        ),
    ]
