# generated by datamodel-codegen:
#   filename:  media_buy/sync_event_sources_request.json
#   timestamp: 2026-02-27T02:10:10+00:00

from __future__ import annotations

from typing import Annotated

from adcp.types.base import AdCPBaseModel
from pydantic import ConfigDict, Field

from ..core import account_ref
from ..core import context as context_1
from ..core import ext as ext_1
from ..enums import event_type


class EventSource(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    allowed_domains: Annotated[
        list[str] | None,
        Field(description='Domains authorized to send events for this event source', min_length=1),
    ] = None
    event_source_id: Annotated[str, Field(description='Unique identifier for this event source')]
    event_types: Annotated[
        list[event_type.EventType] | None,
        Field(
            description='Event types this source handles (e.g. purchase, lead). If omitted, accepts all event types.',
            min_length=1,
        ),
    ] = None
    name: Annotated[str | None, Field(description='Human-readable name for this event source')] = (
        None
    )


class SyncEventSourcesRequest(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    account: Annotated[
        account_ref.AccountReference, Field(description='Account to configure event sources for.')
    ]
    context: context_1.ContextObject | None = None
    delete_missing: Annotated[
        bool | None,
        Field(description='When true, event sources not included in this sync will be removed'),
    ] = False
    event_sources: Annotated[
        list[EventSource] | None,
        Field(
            description='Event sources to sync (create or update). When omitted, the call is discovery-only and returns all existing event sources on the account without modification.',
            min_length=1,
        ),
    ] = None
    ext: ext_1.ExtensionObject | None = None
