# generated by datamodel-codegen:
#   filename:  asset-type.json
#   timestamp: 2025-11-15T22:03:55+00:00

from __future__ import annotations

from enum import Enum
from typing import Annotated

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


class ContentLength(AdCPBaseModel):
    max_characters: Annotated[int | None, Field(ge=1)] = None
    max_words: Annotated[int | None, Field(ge=1)] = None
    min_characters: Annotated[int | None, Field(ge=0)] = None
    min_words: Annotated[int | None, Field(ge=0)] = None


class Dimensions(AdCPBaseModel):
    aspect_ratio: str | None = None
    height: Annotated[int | None, Field(ge=1)] = None
    max_height: Annotated[int | None, Field(ge=1)] = None
    max_width: Annotated[int | None, Field(ge=1)] = None
    min_height: Annotated[int | None, Field(ge=1)] = None
    min_width: Annotated[int | None, Field(ge=1)] = None
    width: Annotated[int | None, Field(ge=1)] = None


class Duration(AdCPBaseModel):
    exact_seconds: Annotated[float | None, Field(ge=0.0)] = None
    max_seconds: Annotated[float | None, Field(ge=0.0)] = None
    min_seconds: Annotated[float | None, Field(ge=0.0)] = None


class FileSize(AdCPBaseModel):
    max_bytes: Annotated[int | None, Field(ge=1)] = None
    min_bytes: Annotated[int | None, Field(ge=0)] = None


class Quality(AdCPBaseModel):
    max_bitrate_kbps: Annotated[int | None, Field(ge=1)] = None
    min_bitrate_kbps: Annotated[int | None, Field(ge=1)] = None
    min_resolution_dpi: Annotated[int | None, Field(ge=72)] = None


class Requirements(AdCPBaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    content_length: ContentLength | None = None
    dimensions: Dimensions | None = None
    duration: Duration | None = None
    file_formats: Annotated[
        list[str] | None,
        Field(description="Acceptable file formats (e.g., ['jpg', 'png'] for images)"),
    ] = None
    file_size: FileSize | None = None
    quality: Quality | None = None


class Type(Enum):
    image = "image"
    video = "video"
    audio = "audio"
    text = "text"
    html = "html"
    css = "css"
    javascript = "javascript"
    vast = "vast"
    daast = "daast"
    promoted_offerings = "promoted_offerings"
    url = "url"


class AssetTypeSchema(AdCPBaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    asset_role: Annotated[
        str,
        Field(
            description="Role or purpose of this asset in the creative (e.g., 'hero_image', 'logo', 'cta_button')"
        ),
    ]
    constraints: Annotated[
        list[str] | None,
        Field(description="Additional constraints or requirements (human-readable)"),
    ] = None
    examples: Annotated[
        list[str] | None, Field(description="Example values or descriptions for this asset")
    ] = None
    required: Annotated[
        bool | None, Field(description="Whether this asset is mandatory for the format")
    ] = True
    requirements: Annotated[
        Requirements | None, Field(description="Technical requirements for this asset type")
    ] = None
    type: Annotated[Type, Field(description="Type of asset")]
