# generated by datamodel-codegen:
#   filename:  content_standards/get_media_buy_artifacts_response.json
#   timestamp: 2026-02-28T17:39:50+00:00

from __future__ import annotations

from enum import Enum
from typing import Annotated

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

from ..core import context as context_1
from ..core import error
from ..core import ext as ext_1
from ..core import pagination_response
from . import artifact as artifact_1


class BrandContext(AdCPBaseModel):
    brand_id: Annotated[str | None, Field(description='Brand identifier')] = None
    sku_id: Annotated[str | None, Field(description='Product/SKU identifier if applicable')] = None


class LocalVerdict(Enum):
    pass_ = 'pass'
    fail = 'fail'
    unevaluated = 'unevaluated'


class Method(Enum):
    random = 'random'
    stratified = 'stratified'
    recent = 'recent'
    failures_only = 'failures_only'


class SamplingInfo(AdCPBaseModel):
    effective_rate: Annotated[float | None, Field(description='Actual sampling rate achieved')] = (
        None
    )
    method: Annotated[Method | None, Field(description='Sampling method used')] = None
    sampled_count: Annotated[
        int | None, Field(description='Number of artifacts in this response')
    ] = None
    total_deliveries: Annotated[
        int | None, Field(description='Total deliveries in the time range')
    ] = None


class GetMediaBuyArtifactsResponse2(AdCPBaseModel):
    context: context_1.ContextObject | None = None
    errors: list[error.Error]
    ext: ext_1.ExtensionObject | None = None


class Artifact(AdCPBaseModel):
    artifact: Annotated[artifact_1.Artifact, Field(description='Full artifact with content assets')]
    brand_context: Annotated[
        BrandContext | None,
        Field(
            description='Brand information for policy evaluation. Schema TBD - placeholder for brand identifiers.'
        ),
    ] = None
    channel: Annotated[
        str | None, Field(description='Channel type (e.g., display, video, audio, social)')
    ] = None
    country: Annotated[
        str | None, Field(description='ISO 3166-1 alpha-2 country code where delivery occurred')
    ] = None
    local_verdict: Annotated[
        LocalVerdict | None, Field(description="Seller's local model verdict for this artifact")
    ] = None
    package_id: Annotated[
        str | None, Field(description='Which package this delivery belongs to')
    ] = None
    record_id: Annotated[str, Field(description='Unique identifier for this delivery record')]
    timestamp: Annotated[AwareDatetime | None, Field(description='When the delivery occurred')] = (
        None
    )


class GetMediaBuyArtifactsResponse1(AdCPBaseModel):
    artifacts: Annotated[
        list[Artifact], Field(description='Delivery records with full artifact content')
    ]
    context: context_1.ContextObject | None = None
    ext: ext_1.ExtensionObject | None = None
    media_buy_id: Annotated[str, Field(description='Media buy these artifacts belong to')]
    pagination: pagination_response.PaginationResponse | None = None
    sampling_info: Annotated[
        SamplingInfo | None, Field(description='Information about how the sample was generated')
    ] = None


class GetMediaBuyArtifactsResponse(
    RootModel[GetMediaBuyArtifactsResponse1 | GetMediaBuyArtifactsResponse2]
):
    root: Annotated[
        GetMediaBuyArtifactsResponse1 | GetMediaBuyArtifactsResponse2,
        Field(
            description='Response containing content artifacts from a media buy for validation',
            title='Get Media Buy Artifacts Response',
        ),
    ]
