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

from __future__ import annotations

from typing import Annotated

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

from ..enums import demographic_system as demographic_system_1
from ..enums import forecast_method
from ..enums import forecast_range_unit as forecast_range_unit_1
from ..enums import reach_unit as reach_unit_1
from . import ext as ext_1
from . import forecast_point


class DeliveryForecast(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    currency: Annotated[
        str,
        Field(
            description='ISO 4217 currency code for monetary values in this forecast (spend, budget)'
        ),
    ]
    demographic: Annotated[
        str | None,
        Field(
            description='Target demographic code within the specified demographic_system. For Nielsen: P18-49, M25-54, W35+. For BARB: ABC1 Adults, 16-34. For AGF: E 14-49.',
            examples=['P18-49', 'A25-54', 'W35+', 'M18-34'],
        ),
    ] = None
    demographic_system: Annotated[
        demographic_system_1.DemographicSystem | None,
        Field(
            description='Measurement system for the demographic field. Ensures buyer and seller agree on demographic notation.'
        ),
    ] = None
    ext: ext_1.ExtensionObject | None = None
    forecast_range_unit: Annotated[
        forecast_range_unit_1.ForecastRangeUnit | None,
        Field(
            description="How to interpret the points array. 'spend' (default when omitted): points at ascending budget levels. 'reach_freq': points at ascending reach/frequency targets. 'weekly'/'daily': metrics are per-period values. 'clicks'/'conversions': points at ascending outcome targets."
        ),
    ] = None
    generated_at: Annotated[
        AwareDatetime | None, Field(description='When this forecast was computed')
    ] = None
    method: Annotated[
        forecast_method.ForecastMethod, Field(description='Method used to produce this forecast')
    ]
    points: Annotated[
        list[forecast_point.ForecastPoint],
        Field(
            description='Forecasted delivery at one or more budget levels. A single point is a standard forecast; multiple points ordered by ascending budget form a curve showing how metrics scale with spend. Each point pairs a budget with metric ranges.',
            min_length=1,
        ),
    ]
    reach_unit: Annotated[
        reach_unit_1.ReachUnit | None,
        Field(
            description='Unit of measurement for reach and audience_size metrics in this forecast. Required for cross-channel forecast comparison.'
        ),
    ] = None
    valid_until: Annotated[
        AwareDatetime | None,
        Field(
            description='When this forecast expires. After this time, the forecast should be refreshed. Forecast expiry does not affect proposal executability.'
        ),
    ] = None
