# generated by datamodel-codegen:
#   filename:  core/brand_manifest.json
#   timestamp: 2026-02-12T02:11:19+00:00

from __future__ import annotations

from enum import Enum
from typing import Annotated, Any, Literal

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

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 Avatar(AdCPBaseModel):
    avatar_id: Annotated[str | None, Field(description='Provider-specific avatar identifier')] = (
        None
    )
    provider: Annotated[
        str | None, Field(description="Avatar provider (e.g., 'd-id', 'heygen', 'synthesia')")
    ] = None
    settings: Annotated[
        dict[str, Any] | None, Field(description='Provider-specific avatar settings')
    ] = None


class Accent(RootModel[str]):
    root: Annotated[str, Field(description='Accent color(s)', pattern='^#[0-9A-Fa-f]{6}$')]


class Accent1Item(RootModel[str]):
    root: Annotated[str, Field(pattern='^#[0-9A-Fa-f]{6}$')]


class Accent1(RootModel[list[Accent1Item]]):
    root: Annotated[list[Accent1Item], Field(description='Accent color(s)', min_length=1)]


class Background(RootModel[str]):
    root: Annotated[str, Field(description='Background color(s)', pattern='^#[0-9A-Fa-f]{6}$')]


class Background1Item(Accent1Item):
    pass


class Background1(RootModel[list[Background1Item]]):
    root: Annotated[list[Background1Item], Field(description='Background color(s)', min_length=1)]


class Primary(RootModel[str]):
    root: Annotated[str, Field(description='Primary brand color(s)', pattern='^#[0-9A-Fa-f]{6}$')]


class Primary1Item(Accent1Item):
    pass


class Primary1(RootModel[list[Primary1Item]]):
    root: Annotated[list[Primary1Item], Field(description='Primary brand color(s)', min_length=1)]


class Secondary(RootModel[str]):
    root: Annotated[str, Field(description='Secondary brand color(s)', pattern='^#[0-9A-Fa-f]{6}$')]


class Secondary1Item(Accent1Item):
    pass


class Secondary1(RootModel[list[Secondary1Item]]):
    root: Annotated[
        list[Secondary1Item], Field(description='Secondary brand color(s)', min_length=1)
    ]


class Text(RootModel[str]):
    root: Annotated[str, Field(description='Text color(s)', pattern='^#[0-9A-Fa-f]{6}$')]


class Text1Item(Accent1Item):
    pass


class Text1(RootModel[list[Text1Item]]):
    root: Annotated[list[Text1Item], Field(description='Text color(s)', min_length=1)]


class Colors(AdCPBaseModel):
    accent: Annotated[Accent | Accent1 | None, Field(description='Accent color(s)')] = None
    background: Annotated[
        Background | Background1 | None, Field(description='Background color(s)')
    ] = None
    primary: Annotated[Primary | Primary1 | None, Field(description='Primary brand color(s)')] = (
        None
    )
    secondary: Annotated[
        Secondary | Secondary1 | None, Field(description='Secondary brand color(s)')
    ] = None
    text: Annotated[Text | Text1 | None, Field(description='Text color(s)')] = 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 Background2(Enum):
    dark_bg = 'dark-bg'
    light_bg = 'light-bg'
    transparent_bg = 'transparent-bg'


class Orientation(Enum):
    square = 'square'
    horizontal = 'horizontal'
    vertical = 'vertical'
    stacked = 'stacked'


class Variant(Enum):
    primary = 'primary'
    secondary = 'secondary'
    icon = 'icon'
    wordmark = 'wordmark'
    full_lockup = 'full-lockup'


class Logo(AdCPBaseModel):
    background: Annotated[
        Background2 | None,
        Field(
            description='Background compatibility. dark-bg: use on dark backgrounds, light-bg: use on light backgrounds, transparent-bg: has transparent background'
        ),
    ] = None
    height: Annotated[int | None, Field(description='Logo height in pixels')] = None
    orientation: Annotated[
        Orientation | None,
        Field(
            description='Logo aspect ratio orientation. square: ~1:1, horizontal: wide, vertical: tall, stacked: vertically arranged elements'
        ),
    ] = None
    tags: Annotated[
        list[str] | None,
        Field(
            description='Additional semantic tags for custom categorization beyond the standard orientation, background, and variant fields.'
        ),
    ] = None
    url: Annotated[AnyUrl, Field(description='URL to the logo asset')]
    usage: Annotated[
        str | None,
        Field(
            description="Human-readable description of when to use this logo variant (e.g., 'Primary logo for use on light backgrounds', 'Icon-only variant for small formats')"
        ),
    ] = None
    variant: Annotated[
        Variant | None,
        Field(
            description='Logo variant type. primary: main logo, secondary: alternative, icon: symbol only, wordmark: text only, full-lockup: complete logo'
        ),
    ] = None
    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 AgenticCheckout(AdCPBaseModel):
    endpoint: Annotated[
        AnyUrl,
        Field(
            description='Base URL for checkout session API (e.g., https://merchant.com/api/checkout_sessions)'
        ),
    ]
    spec: Annotated[
        Literal['openai_agentic_checkout_v1'],
        Field(description='Checkout API specification implemented by the endpoint'),
    ]
    supported_payment_providers: Annotated[
        list[str] | None, Field(description='Payment providers supported by this checkout endpoint')
    ] = None


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


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


class ProductCatalog(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    agentic_checkout: Annotated[
        AgenticCheckout | None,
        Field(
            description='Agentic checkout endpoint configuration. Enables AI agents to complete purchases on behalf of users through a structured checkout API.'
        ),
    ] = None
    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. Use 'openai_product_feed' for feeds conforming to the OpenAI Commerce Product Feed specification."
        ),
    ] = 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 Tone(AdCPBaseModel):
    attributes: Annotated[
        list[str] | None,
        Field(
            description='Personality traits that characterize the brand voice',
            examples=[['friendly', 'optimistic', 'conversational', 'authentic']],
        ),
    ] = None
    donts: Annotated[
        list[str] | None,
        Field(
            description='Guardrails to avoid brand violations - what NOT to do',
            examples=[
                [
                    'Avoid corporate jargon',
                    "Don't be overly formal",
                    "Don't make exaggerated claims",
                ]
            ],
        ),
    ] = None
    dos: Annotated[
        list[str] | None,
        Field(
            description='Specific guidance for copy generation - what TO do',
            examples=[
                [
                    'Use simple, everyday language',
                    'Address the reader directly',
                    'Keep sentences short and punchy',
                ]
            ],
        ),
    ] = None
    voice: Annotated[
        str | None,
        Field(
            description="High-level voice descriptor (e.g., 'warm and inviting', 'professional and trustworthy')"
        ),
    ] = None


class Voice(AdCPBaseModel):
    provider: Annotated[
        str | None, Field(description="TTS provider (e.g., 'elevenlabs', 'openai', 'amazon_polly')")
    ] = None
    settings: Annotated[
        dict[str, Any] | None,
        Field(description='Provider-specific voice settings (speed, pitch, etc.)'),
    ] = None
    voice_id: Annotated[str | None, Field(description='Provider-specific voice identifier')] = 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
    avatar: Annotated[
        Avatar | None,
        Field(description='Brand avatar configuration for visual conversational experiences'),
    ] = None
    colors: Annotated[
        Colors | None,
        Field(
            description='Brand color palette. Each role accepts a single hex color or an array of hex colors for brands with multiple values per role.'
        ),
    ] = 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 structured fields for orientation, background compatibility, and variant type. Use the orientation, background, and variant enum fields for reliable filtering by creative agents.'
        ),
    ] = None
    metadata: Annotated[Metadata | None, Field(description='Additional brand metadata')] = None
    name: Annotated[str, Field(description='Brand or business name')]
    privacy_policy_url: Annotated[
        AnyUrl | None,
        Field(
            description="URL to the brand's privacy policy. Used for consumer consent flows when personal data may be shared with the advertiser. AI platforms can use this to present explicit privacy choices to users before data handoff."
        ),
    ] = None
    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 | Tone | None,
        Field(description='Brand voice and messaging tone guidelines for creative agents.'),
    ] = 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
    voice: Annotated[
        Voice | None,
        Field(description='Brand voice configuration for audio/conversational experiences'),
    ] = None
