# generated by datamodel-codegen:
#   filename:  core/product_filters.json
#   timestamp: 2025-11-29T12:00:45+00:00

from __future__ import annotations

from datetime import date
from typing import Annotated

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

from ..enums import channels as channels_1
from ..enums import delivery_type as delivery_type_1
from ..enums import format_category
from . import format_id


class BudgetRange(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    currency: Annotated[
        str,
        Field(
            description="ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP')", pattern='^[A-Z]{3}$'
        ),
    ]
    max: Annotated[float | None, Field(description='Maximum budget amount', ge=0.0)] = None
    min: Annotated[float, Field(description='Minimum budget amount', ge=0.0)]


class BudgetRange1(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    currency: Annotated[
        str,
        Field(
            description="ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP')", pattern='^[A-Z]{3}$'
        ),
    ]
    max: Annotated[float, Field(description='Maximum budget amount', ge=0.0)]
    min: Annotated[float | None, Field(description='Minimum budget amount', ge=0.0)] = None


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


class ProductFilters(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    budget_range: Annotated[
        BudgetRange | BudgetRange1 | None,
        Field(description='Budget range to filter appropriate products'),
    ] = None
    channels: Annotated[
        list[channels_1.AdvertisingChannels] | None,
        Field(description="Filter by advertising channels (e.g., ['display', 'video', 'dooh'])"),
    ] = None
    countries: Annotated[
        list[Country] | None,
        Field(
            description="Filter by target countries using ISO 3166-1 alpha-2 country codes (e.g., ['US', 'CA', 'GB'])"
        ),
    ] = None
    delivery_type: delivery_type_1.DeliveryType | None = None
    end_date: Annotated[
        date | None,
        Field(
            description='Campaign end date (ISO 8601 date format: YYYY-MM-DD) for availability checks'
        ),
    ] = None
    format_ids: Annotated[
        list[format_id.FormatId] | None, Field(description='Filter by specific format IDs')
    ] = None
    format_types: Annotated[
        list[format_category.FormatCategory] | None, Field(description='Filter by format types')
    ] = None
    is_fixed_price: Annotated[
        bool | None, Field(description='Filter for fixed price vs auction products')
    ] = None
    min_exposures: Annotated[
        int | None,
        Field(description='Minimum exposures/impressions needed for measurement validity', ge=1),
    ] = None
    standard_formats_only: Annotated[
        bool | None, Field(description='Only return products accepting IAB standard formats')
    ] = None
    start_date: Annotated[
        date | None,
        Field(
            description='Campaign start date (ISO 8601 date format: YYYY-MM-DD) for availability checks'
        ),
    ] = None
