# generated by datamodel-codegen:
#   filename:  sponsored_intelligence/si_get_offering_response.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 ..core import error
from ..core import ext as ext_1


class MatchingProduct(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    availability_summary: Annotated[
        str | None,
        Field(
            description="Brief availability info (e.g., 'In stock', 'Size 14 available', '3 left')"
        ),
    ] = None
    image_url: Annotated[AnyUrl | None, Field(description='Product image')] = None
    name: Annotated[str, Field(description='Product name')]
    original_price: Annotated[str | None, Field(description='Original price if on sale')] = None
    price: Annotated[str | None, Field(description="Display price (e.g., '$129', '$89.99')")] = None
    product_id: Annotated[str, Field(description='Product identifier')]
    url: Annotated[AnyUrl | None, Field(description='Product detail page URL')] = None


class Offering(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    expires_at: Annotated[AwareDatetime | None, Field(description='When this offering expires')] = (
        None
    )
    image_url: Annotated[AnyUrl | None, Field(description='Hero image for the offering')] = None
    landing_url: Annotated[AnyUrl | None, Field(description='Landing page URL')] = None
    offering_id: Annotated[str | None, Field(description='Offering identifier')] = None
    price_hint: Annotated[
        str | None, Field(description="Price indication (e.g., 'from $199', '50% off')")
    ] = None
    summary: Annotated[str | None, Field(description='Brief summary of the offering')] = None
    tagline: Annotated[str | None, Field(description='Short promotional tagline')] = None
    title: Annotated[str | None, Field(description='Offering title')] = None


class SiGetOfferingResponse(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    alternative_offering_ids: Annotated[
        list[str] | None,
        Field(description='Alternative offerings to consider if this one is unavailable'),
    ] = None
    available: Annotated[bool, Field(description='Whether the offering is currently available')]
    checked_at: Annotated[
        AwareDatetime | None, Field(description='When this offering information was retrieved')
    ] = None
    errors: Annotated[
        list[error.Error] | None, Field(description='Errors during offering lookup')
    ] = None
    ext: ext_1.ExtensionObject | None = None
    matching_products: Annotated[
        list[MatchingProduct] | None,
        Field(
            description='Products matching the request context. Only included if include_products was true.'
        ),
    ] = None
    offering: Annotated[Offering | None, Field(description='Offering details')] = None
    offering_token: Annotated[
        str | None,
        Field(
            description="Token to pass to si_initiate_session for session continuity. Brand stores the full query context server-side (products shown, order, context) so they can resolve references like 'the second one' when the session starts."
        ),
    ] = None
    total_matching: Annotated[
        int | None,
        Field(
            description='Total number of products matching the context (may be more than returned in matching_products)',
            ge=0,
        ),
    ] = None
    ttl_seconds: Annotated[
        int | None,
        Field(
            description='How long this offering information is valid (seconds). Host should re-fetch after TTL expires.',
            ge=0,
        ),
    ] = None
    unavailable_reason: Annotated[
        str | None,
        Field(
            description="If not available, why (e.g., 'expired', 'sold_out', 'region_restricted')"
        ),
    ] = None
