# generated by datamodel-codegen:
#   filename:  brand-manifest-ref.json
#   timestamp: 2025-11-15T17:39:52+00:00

from __future__ import annotations

from enum import Enum
from typing import Any

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


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


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


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


class AssetType(Enum):
    image = "image"
    video = "video"
    audio = "audio"
    text = "text"


class Asset(AdCPBaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    asset_id: str = Field(..., description="Unique identifier for this asset")
    asset_type: AssetType = Field(..., description="Type of asset")
    url: AnyUrl = Field(..., description="URL to CDN-hosted asset file")
    tags: list[str] | None = Field(
        None, description="Tags for asset discovery (e.g., 'holiday', 'lifestyle', 'product_shot')"
    )
    name: str | None = Field(None, description="Human-readable asset name")
    description: str | None = Field(None, description="Asset description or usage notes")
    width: int | None = Field(None, description="Image/video width in pixels")
    height: int | None = Field(None, description="Image/video height in pixels")
    duration_seconds: float | None = Field(None, description="Video/audio duration in seconds")
    file_size_bytes: int | None = Field(None, description="File size in bytes")
    format: str | None = Field(None, description="File format (e.g., 'jpg', 'mp4', 'mp3')")
    metadata: dict[str, Any] | None = Field(None, description="Additional asset-specific metadata")


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="forbid",
    )
    feed_url: AnyUrl = Field(..., description="URL to product catalog feed")
    feed_format: FeedFormat | None = Field(
        FeedFormat.google_merchant_center, description="Format of the product feed"
    )
    categories: list[str] | None = Field(
        None, description="Product categories available in the catalog (for filtering)"
    )
    last_updated: AwareDatetime | None = Field(
        None, description="When the product catalog was last updated"
    )
    update_frequency: UpdateFrequency | None = Field(
        None, description="How frequently the product catalog is updated"
    )


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


class Contact(AdCPBaseModel):
    email: EmailStr | None = Field(None, description="Contact email")
    phone: str | None = Field(None, description="Contact phone number")


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


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


class Asset1(AdCPBaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    asset_id: str = Field(..., description="Unique identifier for this asset")
    asset_type: AssetType = Field(..., description="Type of asset")
    url: AnyUrl = Field(..., description="URL to CDN-hosted asset file")
    tags: list[str] | None = Field(
        None, description="Tags for asset discovery (e.g., 'holiday', 'lifestyle', 'product_shot')"
    )
    name: str | None = Field(None, description="Human-readable asset name")
    description: str | None = Field(None, description="Asset description or usage notes")
    width: int | None = Field(None, description="Image/video width in pixels")
    height: int | None = Field(None, description="Image/video height in pixels")
    duration_seconds: float | None = Field(None, description="Video/audio duration in seconds")
    file_size_bytes: int | None = Field(None, description="File size in bytes")
    format: str | None = Field(None, description="File format (e.g., 'jpg', 'mp4', 'mp3')")
    metadata: dict[str, Any] | None = Field(None, description="Additional asset-specific metadata")


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


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


class BrandManifest(RootModel[BrandManifest1 | BrandManifest2]):
    root: BrandManifest1 | BrandManifest2 = Field(
        ...,
        description="Standardized brand information manifest for creative generation and media buying. Enables low-friction creative workflows by providing brand context that can be easily cached and shared across requests.",
        examples=[
            {
                "description": "Example with both URL and name",
                "data": {"url": "https://bobsfunburgers.com", "name": "Bob's Fun Burgers"},
            },
            {
                "description": "Example: white-label brand without dedicated URL",
                "data": {
                    "name": "Great Value",
                    "colors": {"primary": "#0071CE", "secondary": "#FFC220"},
                    "tone": "affordable and trustworthy",
                },
            },
            {
                "description": "Full brand manifest with all fields",
                "data": {
                    "url": "https://acmecorp.com",
                    "name": "ACME Corporation",
                    "logos": [
                        {
                            "url": "https://cdn.acmecorp.com/logo-square-dark.png",
                            "tags": ["dark", "square"],
                            "width": 512,
                            "height": 512,
                        },
                        {
                            "url": "https://cdn.acmecorp.com/logo-horizontal-light.png",
                            "tags": ["light", "horizontal"],
                            "width": 1200,
                            "height": 400,
                        },
                    ],
                    "colors": {
                        "primary": "#FF6B35",
                        "secondary": "#004E89",
                        "accent": "#F7931E",
                        "background": "#FFFFFF",
                        "text": "#1A1A1A",
                    },
                    "fonts": {"primary": "Helvetica Neue", "secondary": "Georgia"},
                    "tone": "professional and trustworthy",
                    "tagline": "Innovation You Can Trust",
                    "assets": [
                        {
                            "asset_id": "hero_winter_2024",
                            "asset_type": "image",
                            "url": "https://cdn.acmecorp.com/hero-winter-2024.jpg",
                            "tags": ["hero", "winter", "holiday", "lifestyle"],
                            "name": "Winter Campaign Hero",
                            "width": 1920,
                            "height": 1080,
                            "format": "jpg",
                        },
                        {
                            "asset_id": "product_video_30s",
                            "asset_type": "video",
                            "url": "https://cdn.acmecorp.com/product-demo-30s.mp4",
                            "tags": ["product", "demo", "30s"],
                            "name": "Product Demo 30 Second",
                            "width": 1920,
                            "height": 1080,
                            "duration_seconds": 30,
                            "format": "mp4",
                        },
                    ],
                    "product_catalog": {
                        "feed_url": "https://acmecorp.com/products.xml",
                        "feed_format": "google_merchant_center",
                        "categories": ["electronics/computers", "electronics/accessories"],
                        "last_updated": "2024-03-15T10:00:00Z",
                        "update_frequency": "hourly",
                    },
                    "disclaimers": [
                        {
                            "text": "Results may vary. Consult a professional before use.",
                            "context": "health_claims",
                            "required": True,
                        }
                    ],
                    "industry": "technology",
                    "target_audience": "business decision-makers aged 35-55",
                },
            },
        ],
        title="Brand Manifest",
    )


class BrandManifestReference(RootModel[BrandManifest | AnyUrl]):
    root: BrandManifest | AnyUrl = Field(
        ...,
        description="Brand manifest provided either as an inline object or a URL string pointing to a hosted manifest",
        examples=[
            {
                "description": "Inline brand manifest",
                "data": {
                    "url": "https://acmecorp.com",
                    "name": "ACME Corporation",
                    "colors": {"primary": "#FF6B35"},
                },
            },
            {
                "description": "URL string reference to hosted manifest",
                "data": "https://cdn.acmecorp.com/brand-manifest.json",
            },
        ],
        title="Brand Manifest Reference",
    )
