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

from __future__ import annotations

from typing import Annotated

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

from ..core import context as context_1
from ..core import datetime_range
from ..core import ext as ext_1
from ..enums import feedback_source as feedback_source_1
from ..enums import metric_type as metric_type_1


class ProvidePerformanceFeedbackRequest1(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    buyer_ref: Annotated[
        str | None, Field(description="Buyer's reference for the media buy", min_length=1)
    ] = None
    context: context_1.ContextObject | None = None
    creative_id: Annotated[
        str | None,
        Field(
            description='Specific creative asset (if feedback is creative-specific)', min_length=1
        ),
    ] = None
    ext: ext_1.ExtensionObject | None = None
    feedback_source: Annotated[
        feedback_source_1.FeedbackSource | None, Field(description='Source of the performance data')
    ] = feedback_source_1.FeedbackSource.buyer_attribution
    measurement_period: Annotated[
        datetime_range.DatetimeRange, Field(description='Time period for performance measurement')
    ]
    media_buy_id: Annotated[
        str, Field(description="Publisher's media buy identifier", min_length=1)
    ]
    metric_type: Annotated[
        metric_type_1.MetricType | None, Field(description='The business metric being measured')
    ] = metric_type_1.MetricType.overall_performance
    package_id: Annotated[
        str | None,
        Field(
            description='Specific package within the media buy (if feedback is package-specific)',
            min_length=1,
        ),
    ] = None
    performance_index: Annotated[
        float,
        Field(
            description='Normalized performance score (0.0 = no value, 1.0 = expected, >1.0 = above expected)',
            ge=0.0,
        ),
    ]


class ProvidePerformanceFeedbackRequest2(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    buyer_ref: Annotated[
        str, Field(description="Buyer's reference for the media buy", min_length=1)
    ]
    context: context_1.ContextObject | None = None
    creative_id: Annotated[
        str | None,
        Field(
            description='Specific creative asset (if feedback is creative-specific)', min_length=1
        ),
    ] = None
    ext: ext_1.ExtensionObject | None = None
    feedback_source: Annotated[
        feedback_source_1.FeedbackSource | None, Field(description='Source of the performance data')
    ] = feedback_source_1.FeedbackSource.buyer_attribution
    measurement_period: Annotated[
        datetime_range.DatetimeRange, Field(description='Time period for performance measurement')
    ]
    media_buy_id: Annotated[
        str | None, Field(description="Publisher's media buy identifier", min_length=1)
    ] = None
    metric_type: Annotated[
        metric_type_1.MetricType | None, Field(description='The business metric being measured')
    ] = metric_type_1.MetricType.overall_performance
    package_id: Annotated[
        str | None,
        Field(
            description='Specific package within the media buy (if feedback is package-specific)',
            min_length=1,
        ),
    ] = None
    performance_index: Annotated[
        float,
        Field(
            description='Normalized performance score (0.0 = no value, 1.0 = expected, >1.0 = above expected)',
            ge=0.0,
        ),
    ]


class ProvidePerformanceFeedbackRequest(
    RootModel[ProvidePerformanceFeedbackRequest1 | ProvidePerformanceFeedbackRequest2]
):
    root: Annotated[
        ProvidePerformanceFeedbackRequest1 | ProvidePerformanceFeedbackRequest2,
        Field(
            description='Request payload for provide_performance_feedback task',
            title='Provide Performance Feedback Request',
        ),
    ]
