# generated by datamodel-codegen:
#   filename:  pricing_options/cpm_auction_option.json
#   timestamp: 2025-11-22T15:23:24+00:00

from __future__ import annotations

from typing import Annotated, Literal

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


class PriceGuidance(AdCPBaseModel):
    floor: Annotated[
        float,
        Field(
            description='Minimum bid price - publisher will reject bids under this value', ge=0.0
        ),
    ]
    p25: Annotated[float | None, Field(description='25th percentile winning price', ge=0.0)] = None
    p50: Annotated[float | None, Field(description='Median winning price', ge=0.0)] = None
    p75: Annotated[float | None, Field(description='75th percentile winning price', ge=0.0)] = None
    p90: Annotated[float | None, Field(description='90th percentile winning price', ge=0.0)] = None


class CpmAuctionPricingOption(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    currency: Annotated[
        str,
        Field(
            description='ISO 4217 currency code',
            examples=['USD', 'EUR', 'GBP', 'JPY'],
            pattern='^[A-Z]{3}$',
        ),
    ]
    is_fixed: Annotated[
        Literal[False],
        Field(description='Whether this is a fixed rate (true) or auction-based (false)'),
    ]
    min_spend_per_package: Annotated[
        float | None,
        Field(
            description='Minimum spend requirement per package using this pricing option, in the specified currency',
            ge=0.0,
        ),
    ] = None
    price_guidance: Annotated[
        PriceGuidance, Field(description='Pricing guidance for auction-based CPM bidding')
    ]
    pricing_model: Annotated[Literal['cpm'], Field(description='Cost per 1,000 impressions')]
    pricing_option_id: Annotated[
        str,
        Field(
            description="Unique identifier for this pricing option within the product (e.g., 'cpm_usd_auction')"
        ),
    ]
