# generated by datamodel-codegen:
#   filename:  core/brand_manifest.json
#   timestamp: 2026-01-08T19:25:24+00:00

from __future__ import annotations

from enum import Enum
from typing import Annotated, Any

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

from ..enums import asset_content_type


class Asset(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    asset_id: Annotated[str, Field(description='Unique identifier for this asset')]
    asset_type: Annotated[
        asset_content_type.AssetContentType,
        Field(
            description='Type of asset. Note: Brand manifests typically contain basic media assets (image, video, audio, text). Code assets (html, javascript, css) and ad markup (vast, daast) are usually not part of brand asset libraries.'
        ),
    ]
    description: Annotated[str | None, Field(description='Asset description or usage notes')] = None
    duration_seconds: Annotated[
        float | None, Field(description='Video/audio duration in seconds')
    ] = None
    file_size_bytes: Annotated[int | None, Field(description='File size in bytes')] = None
    format: Annotated[str | None, Field(description="File format (e.g., 'jpg', 'mp4', 'mp3')")] = (
        None
    )
    height: Annotated[int | None, Field(description='Image/video height in pixels')] = None
    metadata: Annotated[
        dict[str, Any] | None, Field(description='Additional asset-specific metadata')
    ] = None
    name: Annotated[str | None, Field(description='Human-readable asset name')] = None
    tags: Annotated[
        list[str] | None,
        Field(
            description="Tags for asset discovery (e.g., 'holiday', 'lifestyle', 'product_shot')"
        ),
    ] = None
    url: Annotated[AnyUrl, Field(description='URL to CDN-hosted asset file')]
    width: Annotated[int | None, Field(description='Image/video width in pixels')] = None


class Colors(AdCPBaseModel):
    accent: Annotated[
        str | None, Field(description='Accent color (hex format)', pattern='^#[0-9A-Fa-f]{6}$')
    ] = None
    background: Annotated[
        str | None, Field(description='Background color (hex format)', pattern='^#[0-9A-Fa-f]{6}$')
    ] = None
    primary: Annotated[
        str | None,
        Field(description='Primary brand color (hex format)', pattern='^#[0-9A-Fa-f]{6}$'),
    ] = None
    secondary: Annotated[
        str | None,
        Field(description='Secondary brand color (hex format)', pattern='^#[0-9A-Fa-f]{6}$'),
    ] = None
    text: Annotated[
        str | None, Field(description='Text color (hex format)', pattern='^#[0-9A-Fa-f]{6}$')
    ] = None


class Contact(AdCPBaseModel):
    email: Annotated[EmailStr | None, Field(description='Contact email')] = None
    phone: Annotated[str | None, Field(description='Contact phone number')] = None


class Disclaimer(AdCPBaseModel):
    context: Annotated[
        str | None,
        Field(
            description="When this disclaimer applies (e.g., 'financial_products', 'health_claims', 'all')"
        ),
    ] = None
    required: Annotated[bool | None, Field(description='Whether this disclaimer must appear')] = (
        True
    )
    text: Annotated[str, Field(description='Disclaimer text')]


class Fonts(AdCPBaseModel):
    font_urls: Annotated[
        list[AnyUrl] | None, Field(description='URLs to web font files if using custom fonts')
    ] = None
    primary: Annotated[str | None, Field(description='Primary font family name')] = None
    secondary: Annotated[str | None, Field(description='Secondary font family name')] = None


class Logo(AdCPBaseModel):
    height: Annotated[int | None, Field(description='Logo height in pixels')] = None
    tags: Annotated[
        list[str] | None,
        Field(
            description="Semantic tags describing the logo variant (e.g., 'dark', 'light', 'square', 'horizontal', 'icon')"
        ),
    ] = None
    url: Annotated[AnyUrl, Field(description='URL to the logo asset')]
    width: Annotated[int | None, Field(description='Logo width in pixels')] = None


class Metadata(AdCPBaseModel):
    created_date: Annotated[
        AwareDatetime | None, Field(description='When this brand manifest was created')
    ] = None
    updated_date: Annotated[
        AwareDatetime | None, Field(description='When this brand manifest was last updated')
    ] = None
    version: Annotated[str | None, Field(description='Brand card version number')] = None


class FeedFormat(Enum):
    google_merchant_center = 'google_merchant_center'
    facebook_catalog = 'facebook_catalog'
    custom = 'custom'


class UpdateFrequency(Enum):
    realtime = 'realtime'
    hourly = 'hourly'
    daily = 'daily'
    weekly = 'weekly'


class ProductCatalog(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    categories: Annotated[
        list[str] | None,
        Field(description='Product categories available in the catalog (for filtering)'),
    ] = None
    feed_format: Annotated[FeedFormat | None, Field(description='Format of the product feed')] = (
        FeedFormat.google_merchant_center
    )
    feed_url: Annotated[AnyUrl, Field(description='URL to product catalog feed')]
    last_updated: Annotated[
        AwareDatetime | None, Field(description='When the product catalog was last updated')
    ] = None
    update_frequency: Annotated[
        UpdateFrequency | None, Field(description='How frequently the product catalog is updated')
    ] = None


class BrandManifest(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    assets: Annotated[
        list[Asset] | None,
        Field(
            description='Brand asset library with explicit assets and tags. Assets are referenced inline with URLs pointing to CDN-hosted files.'
        ),
    ] = None
    colors: Annotated[Colors | None, Field(description='Brand color palette')] = None
    contact: Annotated[Contact | None, Field(description='Brand contact information')] = None
    disclaimers: Annotated[
        list[Disclaimer] | None,
        Field(description='Legal disclaimers or required text that must appear in creatives'),
    ] = None
    fonts: Annotated[Fonts | None, Field(description='Brand typography guidelines')] = None
    industry: Annotated[
        str | None,
        Field(
            description="Industry or vertical (e.g., 'retail', 'automotive', 'finance', 'healthcare')"
        ),
    ] = None
    logos: Annotated[
        list[Logo] | None,
        Field(description='Brand logo assets with semantic tags for different use cases'),
    ] = None
    metadata: Annotated[Metadata | None, Field(description='Additional brand metadata')] = None
    name: Annotated[str, Field(description='Brand or business name')]
    product_catalog: Annotated[
        ProductCatalog | None,
        Field(
            description='Product catalog information for e-commerce advertisers. Enables SKU-level creative generation and product selection.'
        ),
    ] = None
    tagline: Annotated[str | None, Field(description='Brand tagline or slogan')] = None
    target_audience: Annotated[
        str | None, Field(description='Primary target audience description')
    ] = None
    tone: Annotated[
        str | None,
        Field(
            description="Brand voice and messaging tone (e.g., 'professional', 'casual', 'humorous', 'trustworthy', 'innovative')"
        ),
    ] = None
    url: Annotated[
        AnyUrl | None,
        Field(
            description='Primary brand URL for context and asset discovery. Creative agents can infer brand information from this URL.'
        ),
    ] = None
