# generated by datamodel-codegen:
#   filename:  brand.json
#   timestamp: 2026-02-23T01:56:40+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 BrandDiscovery1(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    field_schema: Annotated[str | None, Field(alias='$schema')] = None
    authoritative_location: Annotated[
        AnyUrl, Field(description='HTTPS URL of the authoritative brand.json file')
    ]
    last_updated: AwareDatetime | None = None


class Trademark(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    mark: str
    number: str
    registry: str


class Asset(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    asset_id: Annotated[str, Field(description='Unique identifier')]
    asset_type: Annotated[
        asset_content_type.AssetContentType, Field(description='Type of asset content')
    ]
    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 name')] = None
    tags: Annotated[
        list[str] | None,
        Field(description="Tags for discovery (e.g., 'hero', 'lifestyle', 'product', 'holiday')"),
    ] = 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 Brand1(RootModel[str]):
    root: Annotated[str, Field(pattern='^([a-z0-9_]+|\\*)$')]


class Country(RootModel[str]):
    root: Annotated[str, Field(pattern='^[A-Z]{2}$')]


class Avatar(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    avatar_id: str | None = None
    provider: str | None = None
    settings: dict[str, Any] | None = None


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


class Disclaimer(AdCPBaseModel):
    context: str | None = None
    required: bool | None = True
    text: str


class Tone(AdCPBaseModel):
    attributes: Annotated[
        list[str] | None, Field(description='Personality traits that characterize the brand voice')
    ] = None
    donts: Annotated[
        list[str] | None, Field(description='Guardrails to avoid brand violations - what NOT to do')
    ] = None
    dos: Annotated[
        list[str] | None, Field(description='Guidance for copy generation - what TO do')
    ] = None
    voice: Annotated[
        str | None,
        Field(
            description="High-level voice descriptor (e.g., 'warm and inviting', 'professional and trustworthy')"
        ),
    ] = None


class Voice(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    provider: str | None = None
    settings: dict[str, Any] | None = None
    voice_id: str | None = None


class BrandAgent(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    id: Annotated[
        str,
        Field(
            description='Agent identifier (useful for logging, multi-tenant DAMs)',
            pattern='^[a-z0-9_]+$',
        ),
    ]
    url: Annotated[AnyUrl, Field(description='Brand agent MCP endpoint URL')]


class BrandId(RootModel[str]):
    root: Annotated[
        str,
        Field(
            description='Brand identifier within the house portfolio. Lowercase alphanumeric with underscores. House chooses this ID.',
            pattern='^[a-z0-9_]+$',
        ),
    ]


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


class ColorValue2Item(ColorValue1):
    pass


class ColorValue2(RootModel[list[ColorValue2Item]]):
    root: Annotated[list[ColorValue2Item], Field(min_length=1)]


class ColorValue(RootModel[ColorValue1 | ColorValue2]):
    root: ColorValue1 | ColorValue2


class Colors(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    accent: ColorValue | None = None
    background: ColorValue | None = None
    primary: ColorValue | None = None
    secondary: ColorValue | None = None
    text: ColorValue | None = None


class Domain(RootModel[str]):
    root: Annotated[
        str,
        Field(
            description='A valid domain name',
            pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
        ),
    ]


class Fonts(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    font_urls: Annotated[list[AnyUrl] | None, Field(description='URLs to web font files')] = None
    primary: Annotated[str | None, Field(description='Primary font family')] = None
    secondary: Annotated[str | None, Field(description='Secondary font family')] = None


class Architecture(Enum):
    branded_house = 'branded_house'
    house_of_brands = 'house_of_brands'
    hybrid = 'hybrid'


class KellerType(Enum):
    master = 'master'
    sub_brand = 'sub_brand'
    endorsed = 'endorsed'
    independent = 'independent'


class LocalizedName(RootModel[dict[str, str]]):
    root: Annotated[dict[str, str], Field(min_length=1)]


class Background(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):
    model_config = ConfigDict(
        extra='allow',
    )
    background: Annotated[
        Background | 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='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')"
        ),
    ] = 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='Width in pixels')] = None


class AgenticCheckout(AdCPBaseModel):
    endpoint: Annotated[AnyUrl, Field(description='Base URL for checkout session API')]
    spec: Annotated[
        Literal['openai_agentic_checkout_v1'], Field(description='Checkout API specification')
    ]
    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')
    ] = None
    categories: Annotated[
        list[str] | None, Field(description='Product categories available in the catalog')
    ] = None
    feed_format: Annotated[FeedFormat | None, Field(description='Format of the product feed')] = (
        None
    )
    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 Store(Enum):
    apple = 'apple'
    google = 'google'
    amazon = 'amazon'
    roku = 'roku'
    samsung = 'samsung'
    lg = 'lg'
    other = 'other'


class Type(Enum):
    website = 'website'
    mobile_app = 'mobile_app'
    ctv_app = 'ctv_app'
    desktop_app = 'desktop_app'
    dooh = 'dooh'
    podcast = 'podcast'
    radio = 'radio'
    streaming_audio = 'streaming_audio'


class Property(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    identifier: Annotated[
        str,
        Field(
            description='Property identifier - domain for websites, bundle ID for apps',
            min_length=1,
        ),
    ]
    primary: Annotated[
        bool | None, Field(description='Whether this is the primary property for the brand')
    ] = False
    region: Annotated[
        str | None,
        Field(
            description="ISO 3166-1 alpha-2 country code or 'global'", pattern='^([A-Z]{2}|global)$'
        ),
    ] = None
    store: Annotated[Store | None, Field(description='App store for mobile/CTV apps')] = None
    type: Annotated[Type, Field(description='Property type')]


class BrandDiscovery2(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    field_schema: Annotated[str | None, Field(alias='$schema')] = None
    house: Annotated[Domain, Field(description='House domain to fetch brand portfolio from')]
    last_updated: AwareDatetime | None = None
    note: str | None = None
    region: Annotated[
        str | None,
        Field(
            description='ISO 3166-1 alpha-2 country code if this is a regional domain',
            pattern='^[A-Z]{2}$',
        ),
    ] = None


class AuthorizedOperator(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    brands: Annotated[
        list[Brand1],
        Field(
            description="Brand IDs this operator is authorized for. Use ['*'] for all brands in the portfolio.",
            min_length=1,
        ),
    ]
    countries: Annotated[
        list[Country] | None,
        Field(
            description='ISO 3166-1 alpha-2 country codes where this authorization applies. Omit for global authorization.'
        ),
    ] = None
    domain: Annotated[
        Domain, Field(description="Domain of the authorized operator (e.g., 'groupm.com')")
    ]


class Brand(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    assets: Annotated[list[Asset] | None, Field(description='Brand asset library')] = None
    avatar: Annotated[Avatar | None, Field(description='Visual avatar configuration')] = None
    brand_agent: Annotated[
        BrandAgent | None, Field(description='Brand agent that provides dynamic brand data via MCP')
    ] = None
    colors: Colors | None = None
    contact: Annotated[Contact1 | None, Field(description='Brand-level contact information')] = None
    description: Annotated[str | None, Field(description='Brand description')] = None
    disclaimers: Annotated[
        list[Disclaimer] | None, Field(description='Legal disclaimers for creatives')
    ] = None
    fonts: Fonts | None = None
    id: Annotated[
        BrandId, Field(description='Brand identifier within the house. House chooses this ID.')
    ]
    industry: Annotated[
        str | None, Field(description="Industry or vertical (e.g., 'retail', 'automotive', 'cpg')")
    ] = None
    keller_type: KellerType | None = None
    logos: Annotated[list[Logo] | None, Field(description='Brand logo assets')] = None
    names: Annotated[
        list[LocalizedName],
        Field(
            description='Localized brand names. Multiple entries per language allowed for aliases.',
            min_length=1,
        ),
    ]
    parent_brand: Annotated[
        BrandId | None, Field(description='Parent brand ID for sub-brands and endorsed brands')
    ] = None
    privacy_policy_url: Annotated[
        AnyUrl | None, Field(description="URL to the brand's privacy policy")
    ] = None
    product_catalog: ProductCatalog | None = None
    properties: Annotated[
        list[Property] | None, Field(description='Digital properties owned by this brand')
    ] = None
    tagline: Annotated[str | None, Field(description='Brand tagline or slogan')] = None
    target_audience: Annotated[str | None, Field(description='Primary target audience')] = None
    tone: Annotated[
        str | Tone | None, Field(description='Brand voice and messaging tone guidelines')
    ] = None
    url: Annotated[
        AnyUrl | None, Field(description='Primary brand URL for context and asset discovery')
    ] = None
    voice: Annotated[Voice | None, Field(description='TTS voice configuration')] = None


class Contact(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    domain: Domain | None = None
    email: Annotated[EmailStr | None, Field(max_length=255)] = None
    name: Annotated[str, Field(max_length=255, min_length=1)]


class House(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    architecture: Annotated[
        Architecture | None,
        Field(
            description='Brand architecture model: branded_house (Google), house_of_brands (P&G), hybrid (Nike)'
        ),
    ] = None
    domain: Annotated[Domain, Field(description="The house's domain where brand.json is hosted")]
    name: Annotated[str, Field(description='Primary display name of the house', min_length=1)]
    names: Annotated[
        list[LocalizedName] | None,
        Field(description='Localized house names including legal name, stock symbol, etc.'),
    ] = None


class BrandDiscovery3(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    field_schema: Annotated[str | None, Field(alias='$schema')] = None
    brand_agent: BrandAgent
    contact: Contact | None = None
    last_updated: AwareDatetime | None = None
    version: str | None = None


class BrandDiscovery4(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    field_schema: Annotated[str | None, Field(alias='$schema')] = None
    authorized_operators: Annotated[
        list[AuthorizedOperator] | None,
        Field(
            description="Entities authorized to represent brands from this house. Third parties (sellers, platforms) can verify an operator's authorization by checking this list. Operators are identified by domain."
        ),
    ] = None
    brands: Annotated[list[Brand], Field(description='Brands owned by this house', min_length=1)]
    contact: Contact | None = None
    house: House
    last_updated: AwareDatetime | None = None
    trademarks: list[Trademark] | None = None
    version: str | None = None


class BrandDiscovery(
    RootModel[BrandDiscovery1 | BrandDiscovery2 | BrandDiscovery3 | BrandDiscovery4]
):
    root: Annotated[
        BrandDiscovery1 | BrandDiscovery2 | BrandDiscovery3 | BrandDiscovery4,
        Field(
            description='Brand identity and discovery file. Hosted at /.well-known/brand.json on house domains. Contains the full brand portfolio with identity, creative assets, and digital properties. Brands are identified by house + brand_id (like properties are identified by publisher + property_id). Supports variants: house portfolio (full brand data), brand agent (agent provides brand info via MCP), house redirect (pointer to house domain), or authoritative location redirect.',
            examples=[
                {
                    '$schema': '/schemas/latest/brand.json',
                    'authoritative_location': 'https://adcontextprotocol.org/brand/abc123/brand.json',
                },
                {
                    '$schema': '/schemas/latest/brand.json',
                    'house': 'nikeinc.com',
                    'note': 'Redirect to house domain for full brand portfolio',
                },
                {
                    '$schema': '/schemas/latest/brand.json',
                    'brand_agent': {'id': 'acme_brand_agent', 'url': 'https://agent.acme.com/mcp'},
                    'version': '1.0',
                },
                {
                    '$schema': '/schemas/latest/brand.json',
                    'brands': [
                        {
                            'colors': {'primary': '#FF6600', 'secondary': '#0066CC'},
                            'contact': {'email': 'brands@pg.com'},
                            'description': 'Laundry detergent brand',
                            'id': 'tide',
                            'industry': 'cpg',
                            'keller_type': 'master',
                            'logos': [
                                {
                                    'background': 'transparent-bg',
                                    'orientation': 'square',
                                    'url': 'https://cdn.pg.com/tide/logo-square.png',
                                    'usage': 'Primary logo for general use',
                                    'variant': 'primary',
                                },
                                {
                                    'background': 'dark-bg',
                                    'orientation': 'horizontal',
                                    'url': 'https://cdn.pg.com/tide/logo-horizontal-dark.png',
                                    'usage': 'Full lockup for dark backgrounds',
                                    'variant': 'full-lockup',
                                },
                            ],
                            'names': [{'en': 'Tide'}, {'es': 'Tide'}, {'zh': '汰渍'}],
                            'properties': [
                                {'identifier': 'tide.com', 'primary': True, 'type': 'website'},
                                {
                                    'identifier': 'com.pg.tide',
                                    'store': 'apple',
                                    'type': 'mobile_app',
                                },
                            ],
                            'tagline': "Tide's In, Dirt's Out",
                            'tone': {
                                'attributes': ['reliable', 'family-friendly', 'confident'],
                                'donts': ['Avoid technical jargon', "Don't be overly serious"],
                                'dos': ['Use simple, direct language', 'Emphasize cleaning power'],
                                'voice': 'clean, fresh, trustworthy',
                            },
                            'url': 'https://tide.com',
                        },
                        {
                            'colors': {'primary': '#00A0D2'},
                            'id': 'pampers',
                            'industry': 'cpg',
                            'keller_type': 'master',
                            'logos': [
                                {
                                    'orientation': 'horizontal',
                                    'url': 'https://cdn.pg.com/pampers/logo.png',
                                    'variant': 'primary',
                                }
                            ],
                            'names': [{'en': 'Pampers'}],
                            'properties': [
                                {'identifier': 'pampers.com', 'primary': True, 'type': 'website'}
                            ],
                            'url': 'https://pampers.com',
                        },
                    ],
                    'contact': {'email': 'brands@pg.com', 'name': 'P&G Brand Team'},
                    'house': {
                        'architecture': 'house_of_brands',
                        'domain': 'pg.com',
                        'name': 'Procter & Gamble',
                    },
                    'last_updated': '2026-01-15T10:00:00Z',
                    'version': '1.0',
                },
                {
                    '$schema': '/schemas/latest/brand.json',
                    'authorized_operators': [
                        {
                            'brands': ['nike', 'air_jordan'],
                            'countries': ['US', 'GB', 'DE', 'FR'],
                            'domain': 'wpp.com',
                        },
                        {'brands': ['nike'], 'countries': ['JP'], 'domain': 'dentsu.co.jp'},
                        {'brands': ['*'], 'domain': 'nike.com'},
                    ],
                    'brands': [
                        {
                            'colors': {'accent': '#FF6600', 'primary': '#111111'},
                            'id': 'nike',
                            'keller_type': 'master',
                            'logos': [
                                {
                                    'background': 'dark-bg',
                                    'orientation': 'horizontal',
                                    'url': 'https://cdn.nike.com/swoosh-dark.svg',
                                    'usage': 'Swoosh icon for dark backgrounds',
                                    'variant': 'icon',
                                },
                                {
                                    'background': 'light-bg',
                                    'orientation': 'horizontal',
                                    'url': 'https://cdn.nike.com/logo-full.svg',
                                    'usage': 'Full logo with wordmark for light backgrounds',
                                    'variant': 'full-lockup',
                                },
                            ],
                            'names': [{'en': 'Nike'}, {'zh': '耐克'}, {'ja': 'ナイキ'}],
                            'properties': [
                                {'identifier': 'nike.com', 'primary': True, 'type': 'website'},
                                {'identifier': 'nike.cn', 'region': 'CN', 'type': 'website'},
                                {
                                    'identifier': 'com.nike.omega',
                                    'store': 'apple',
                                    'type': 'mobile_app',
                                },
                            ],
                            'tagline': 'Just Do It',
                            'tone': 'inspirational, bold, athletic',
                            'url': 'https://nike.com',
                        },
                        {
                            'brand_agent': {'id': 'nike_dam', 'url': 'https://dam.nike.com/mcp'},
                            'colors': {'primary': '#CE1141', 'secondary': '#111111'},
                            'id': 'air_jordan',
                            'keller_type': 'endorsed',
                            'logos': [
                                {
                                    'background': 'transparent-bg',
                                    'orientation': 'square',
                                    'url': 'https://cdn.nike.com/jumpman.svg',
                                    'variant': 'icon',
                                }
                            ],
                            'names': [{'en': 'Air Jordan'}, {'en': 'Jordan'}, {'en': 'Jumpman'}],
                            'parent_brand': 'nike',
                            'properties': [
                                {'identifier': 'jordan.com', 'primary': True, 'type': 'website'},
                                {'identifier': 'jumpman23.com', 'type': 'website'},
                            ],
                            'url': 'https://jordan.com',
                        },
                        {
                            'id': 'converse',
                            'keller_type': 'independent',
                            'logos': [
                                {
                                    'orientation': 'square',
                                    'url': 'https://cdn.converse.com/star.svg',
                                    'variant': 'icon',
                                }
                            ],
                            'names': [{'en': 'Converse'}],
                            'properties': [
                                {'identifier': 'converse.com', 'primary': True, 'type': 'website'}
                            ],
                            'url': 'https://converse.com',
                        },
                    ],
                    'house': {
                        'architecture': 'hybrid',
                        'domain': 'nikeinc.com',
                        'name': 'Nike, Inc.',
                    },
                    'last_updated': '2026-01-15T10:00:00Z',
                    'version': '1.0',
                },
            ],
            title='Brand Discovery',
        ),
    ]
