# generated by datamodel-codegen:
#   filename:  content_standards/artifact_webhook_payload.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 AwareDatetime, ConfigDict, Field

from ..core import ext as ext_1
from . import artifact as artifact_1


class Pagination(AdCPBaseModel):
    batch_number: Annotated[int | None, Field(description='Current batch number (1-indexed)')] = (
        None
    )
    total_artifacts: Annotated[
        int | None, Field(description='Total artifacts in the delivery period')
    ] = None
    total_batches: Annotated[
        int | None, Field(description='Total batches for this delivery period')
    ] = None


class Artifact(AdCPBaseModel):
    artifact: Annotated[artifact_1.Artifact, Field(description='The content artifact')]
    delivered_at: Annotated[
        AwareDatetime, Field(description='When the impression was delivered (ISO 8601)')
    ]
    impression_id: Annotated[
        str | None,
        Field(description='Optional impression identifier for correlation with delivery reports'),
    ] = None
    package_id: Annotated[
        str | None, Field(description='Package within the media buy this artifact relates to')
    ] = None


class ArtifactWebhookPayload(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    artifacts: Annotated[
        list[Artifact], Field(description='Content artifacts from delivered impressions')
    ]
    batch_id: Annotated[
        str,
        Field(
            description='Unique identifier for this batch of artifacts. Use for deduplication and acknowledgment.'
        ),
    ]
    ext: ext_1.ExtensionObject | None = None
    media_buy_id: Annotated[
        str, Field(description='Media buy identifier these artifacts belong to')
    ]
    pagination: Annotated[
        Pagination | None, Field(description='Pagination info when batching large artifact sets')
    ] = None
    timestamp: Annotated[
        AwareDatetime, Field(description='When this batch was generated (ISO 8601)')
    ]
