# generated by datamodel-codegen:
#   filename:  core/signal_targeting.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

from . import signal_id as signal_id_1


class SignalTargeting1(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    signal_id: Annotated[signal_id_1.SignalId, Field(description='The signal to target')]
    value: Annotated[
        bool,
        Field(
            description='Whether to include (true) or exclude (false) users matching this signal'
        ),
    ]
    value_type: Annotated[Literal['binary'], Field(description='Discriminator for binary signals')]


class SignalTargeting2(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    signal_id: Annotated[signal_id_1.SignalId, Field(description='The signal to target')]
    value_type: Annotated[
        Literal['categorical'], Field(description='Discriminator for categorical signals')
    ]
    values: Annotated[
        list[str],
        Field(
            description='Values to target. Users with any of these values will be included.',
            min_length=1,
        ),
    ]


class SignalTargeting3(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    max_value: Annotated[
        float | None,
        Field(
            description="Maximum value (inclusive). Omit for no maximum. Must be >= min_value when both are provided. Should be <= signal's range.max if defined."
        ),
    ] = None
    min_value: Annotated[
        float | None,
        Field(
            description="Minimum value (inclusive). Omit for no minimum. Must be <= max_value when both are provided. Should be >= signal's range.min if defined."
        ),
    ] = None
    signal_id: Annotated[signal_id_1.SignalId, Field(description='The signal to target')]
    value_type: Annotated[
        Literal['numeric'], Field(description='Discriminator for numeric signals')
    ]


class SignalTargeting(RootModel[SignalTargeting1 | SignalTargeting2 | SignalTargeting3]):
    root: Annotated[
        SignalTargeting1 | SignalTargeting2 | SignalTargeting3,
        Field(
            description='Targeting constraint for a specific signal. Uses value_type as discriminator to determine the targeting expression format.',
            discriminator='value_type',
            title='Signal Targeting',
        ),
    ]
