# generated by datamodel-codegen:
#   filename:  account/sync_accounts_request.json
#   timestamp: 2026-02-27T02:10:10+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

from ..core import brand_ref
from ..core import context as context_1
from ..core import ext as ext_1
from ..core import push_notification_config as push_notification_config_1


class Billing(Enum):
    operator = 'operator'
    agent = 'agent'


class Account(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    billing: Annotated[
        Billing,
        Field(
            description='Who should be invoiced. operator: seller invoices the operator (agency or brand buying direct). agent: agent consolidates billing across brands. The seller must either accept this billing model or reject the request.'
        ),
    ]
    brand: Annotated[
        brand_ref.BrandReference,
        Field(
            description="Brand reference identifying the advertiser. Uses the brand's house domain and optional brand_id from brand.json."
        ),
    ]
    operator: Annotated[
        str,
        Field(
            description="Domain of the entity operating on the brand's behalf (e.g., 'pinnacle-media.com'). When the brand operates directly, this is the brand's domain. Verified against the brand's authorized_operators in brand.json.",
            pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
        ),
    ]
    sandbox: Annotated[
        bool | None,
        Field(
            description='When true, provision this as a sandbox account. No real platform calls or billing. Sandbox accounts are identified by account_id in subsequent requests.'
        ),
    ] = None


class SyncAccountsRequest(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    accounts: Annotated[
        list[Account], Field(description='Advertiser accounts to sync', max_length=1000)
    ]
    context: context_1.ContextObject | None = None
    delete_missing: Annotated[
        bool | None,
        Field(
            description='When true, accounts previously synced by this agent but not included in this request will be deactivated. Scoped to the authenticated agent — does not affect accounts managed by other agents. Use with caution.'
        ),
    ] = False
    dry_run: Annotated[
        bool | None,
        Field(
            description='When true, preview what would change without applying. Returns what would be created/updated/deactivated.'
        ),
    ] = False
    ext: ext_1.ExtensionObject | None = None
    push_notification_config: Annotated[
        push_notification_config_1.PushNotificationConfig | None,
        Field(
            description='Webhook for async notifications when account status changes (e.g., pending_approval transitions to active).'
        ),
    ] = None
