# generated by datamodel-codegen:
#   filename:  get-signals-response.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

from . import deployment, error


class Pricing(AdCPBaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    cpm: Annotated[float, Field(description="Cost per thousand impressions", ge=0.0)]
    currency: Annotated[str, Field(description="Currency code", pattern="^[A-Z]{3}$")]


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


class Signal(AdCPBaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    coverage_percentage: Annotated[
        float, Field(description="Percentage of audience coverage", ge=0.0, le=100.0)
    ]
    data_provider: Annotated[str, Field(description="Name of the data provider")]
    deployments: Annotated[
        list[deployment.Deployment1 | deployment.Deployment2],
        Field(description="Array of destination deployments"),
    ]
    description: Annotated[str, Field(description="Detailed signal description")]
    name: Annotated[str, Field(description="Human-readable signal name")]
    pricing: Annotated[Pricing, Field(description="Pricing information")]
    signal_agent_segment_id: Annotated[str, Field(description="Unique identifier for the signal")]
    signal_type: Annotated[SignalType, Field(description="Type of signal")]


class GetSignalsResponse(AdCPBaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    context: Annotated[
        dict[str, Any] | None,
        Field(
            description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers."
        ),
    ] = None
    errors: Annotated[
        list[error.Error] | None,
        Field(
            description="Task-specific errors and warnings (e.g., signal discovery or pricing issues)"
        ),
    ] = None
    signals: Annotated[list[Signal], Field(description="Array of matching signals")]
