# generated by datamodel-codegen:
#   filename:  core/event.json
#   timestamp: 2026-02-23T01:56:40+00:00

from __future__ import annotations

from typing import Annotated

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

from ..enums import action_source as action_source_1
from ..enums import event_type as event_type_1
from . import event_custom_data
from . import ext as ext_1
from . import user_match as user_match_1


class Event(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    action_source: Annotated[
        action_source_1.ActionSource | None, Field(description='Where the event originated')
    ] = None
    custom_data: Annotated[
        event_custom_data.EventCustomData | None,
        Field(description='Event-specific data (value, currency, items, etc.)'),
    ] = None
    custom_event_name: Annotated[
        str | None, Field(description="Name for custom events (used when event_type is 'custom')")
    ] = None
    event_id: Annotated[
        str,
        Field(
            description='Unique identifier for deduplication (scoped to event_type + event_source_id)',
            max_length=256,
            min_length=1,
        ),
    ]
    event_source_url: Annotated[
        AnyUrl | None,
        Field(
            description="URL where the event occurred (required when action_source is 'website')"
        ),
    ] = None
    event_time: Annotated[
        AwareDatetime, Field(description='ISO 8601 timestamp when the event occurred')
    ]
    event_type: Annotated[event_type_1.EventType, Field(description='Standard event type')]
    ext: ext_1.ExtensionObject | None = None
    user_match: Annotated[
        user_match_1.UserMatch | None,
        Field(description='User identifiers for attribution matching'),
    ] = None
