# generated by datamodel-codegen:
#   filename:  core/creative_asset.json
#   timestamp: 2025-11-22T19:54:03+00:00

from __future__ import annotations

from typing import Annotated

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

from . import format_id as format_id_1
from . import promoted_offerings
from .assets import (
    audio_asset,
    css_asset,
    daast_asset,
    html_asset,
    image_asset,
    javascript_asset,
    text_asset,
    url_asset,
    vast_asset,
    video_asset,
)


class Input(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    context_description: Annotated[
        str | None,
        Field(description='Natural language description of the context for AI-generated content'),
    ] = None
    macros: Annotated[
        dict[str, str] | None, Field(description='Macro values to apply for this preview')
    ] = None
    name: Annotated[str, Field(description='Human-readable name for this preview variant')]


class CreativeAsset(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    approved: Annotated[
        bool | None,
        Field(
            description='For generative creatives: set to true to approve and finalize, false to request regeneration with updated assets/message. Omit for non-generative creatives.'
        ),
    ] = None
    assets: Annotated[
        dict[
            str,
            image_asset.ImageAsset
            | video_asset.VideoAsset
            | audio_asset.AudioAsset
            | text_asset.TextAsset
            | html_asset.HtmlAsset
            | css_asset.CssAsset
            | javascript_asset.JavascriptAsset
            | promoted_offerings.PromotedOfferings
            | url_asset.UrlAsset
            | vast_asset.VastAsset1
            | vast_asset.VastAsset2
            | daast_asset.DaastAsset1
            | daast_asset.DaastAsset2,
        ],
        Field(description='Assets required by the format, keyed by asset_role'),
    ]
    creative_id: Annotated[str, Field(description='Unique identifier for the creative')]
    format_id: Annotated[
        format_id_1.FormatId,
        Field(
            description='Format identifier specifying which format this creative conforms to. Can be: (1) concrete format_id referencing a format with fixed dimensions, (2) template format_id referencing a template format, or (3) parameterized format_id with dimensions/duration parameters for template formats.'
        ),
    ]
    inputs: Annotated[
        list[Input] | None,
        Field(
            description='Preview contexts for generative formats - defines what scenarios to generate previews for'
        ),
    ] = None
    name: Annotated[str, Field(description='Human-readable creative name')]
    placement_ids: Annotated[
        list[str] | None,
        Field(
            description="Optional array of placement IDs where this creative should run when uploading via create_media_buy or update_media_buy. References placement_id values from the product's placements array. If omitted, creative runs on all placements. Only used during upload to media buy - not stored in creative library.",
            min_length=1,
        ),
    ] = None
    tags: Annotated[
        list[str] | None, Field(description='User-defined tags for organization and searchability')
    ] = None
    weight: Annotated[
        float | None,
        Field(
            description='Optional delivery weight for creative rotation when uploading via create_media_buy or update_media_buy (0-100). If omitted, platform determines rotation. Only used during upload to media buy - not stored in creative library.',
            ge=0.0,
            le=100.0,
        ),
    ] = None
