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

from __future__ import annotations

from enum import Enum
from typing import Annotated, Any

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

from ..core import context as context_1
from ..core import error
from ..core import ext as ext_1


class Status(Enum):
    passed = 'passed'
    failed = 'failed'
    warning = 'warning'
    unevaluated = 'unevaluated'


class Feature(AdCPBaseModel):
    feature_id: str
    message: str | None = None
    rule_id: Annotated[
        str | None,
        Field(
            description='Which rule triggered this result (e.g., GARM category, Scope3 standard)'
        ),
    ] = None
    status: Status
    value: Any | None = None


class Verdict(Enum):
    pass_ = 'pass'
    fail = 'fail'


class Result(AdCPBaseModel):
    features: Annotated[
        list[Feature] | None, Field(description='Optional feature-level breakdown')
    ] = None
    record_id: Annotated[str, Field(description='Which delivery record was evaluated')]
    verdict: Annotated[Verdict, Field(description='Overall pass/fail verdict for this record')]


class Summary(AdCPBaseModel):
    failed_records: int
    passed_records: int
    total_records: int


class ValidateContentDeliveryResponse1(AdCPBaseModel):
    context: context_1.ContextObject | None = None
    ext: ext_1.ExtensionObject | None = None
    results: Annotated[list[Result], Field(description='Per-record evaluation results')]
    summary: Annotated[Summary, Field(description='Summary counts across all records')]


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


class ValidateContentDeliveryResponse(
    RootModel[ValidateContentDeliveryResponse1 | ValidateContentDeliveryResponse2]
):
    root: Annotated[
        ValidateContentDeliveryResponse1 | ValidateContentDeliveryResponse2,
        Field(
            description='Response payload with per-record verdicts and optional feature breakdown',
            title='Validate Content Delivery Response',
        ),
    ]
