# generated by datamodel-codegen:
#   filename:  sponsored_intelligence/si_send_message_response.json
#   timestamp: 2026-02-23T01:56:40+00:00

from __future__ import annotations

from enum import Enum
from typing import Annotated, Any

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

from ..a2ui import surface as surface_1
from ..core import error
from ..core import ext as ext_1
from . import si_ui_element


class ContextForCheckout(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    applied_offers: Annotated[
        list[str] | None, Field(description='Offer IDs that were applied during the conversation')
    ] = None
    conversation_summary: Annotated[
        str | None, Field(description='Summary of the conversation leading to purchase')
    ] = None


class Price(AdCPBaseModel):
    amount: float | None = None
    currency: str | None = None


class Intent(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    action: Annotated[str | None, Field(description="The commerce action (e.g., 'purchase')")] = (
        None
    )
    price: Annotated[Price | None, Field(description='Price information')] = None
    product: Annotated[dict[str, Any] | None, Field(description='Product details for checkout')] = (
        None
    )


class Type(Enum):
    transaction = 'transaction'
    complete = 'complete'


class Handoff(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    context_for_checkout: Annotated[
        ContextForCheckout | None, Field(description='Context to pass to ACP for seamless checkout')
    ] = None
    intent: Annotated[
        Intent | None,
        Field(description='For transaction handoffs: what the user wants to purchase'),
    ] = None
    type: Annotated[
        Type | None,
        Field(
            description='Type of handoff: transaction (ready for ACP checkout) or complete (conversation done)'
        ),
    ] = None


class SessionStatus(Enum):
    active = 'active'
    pending_handoff = 'pending_handoff'
    complete = 'complete'


class Response(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    message: Annotated[str | None, Field(description='Conversational message from brand agent')] = (
        None
    )
    surface: Annotated[
        surface_1.A2UiSurface | None, Field(description='A2UI surface with interactive components')
    ] = None
    ui_elements: Annotated[
        list[si_ui_element.SiUiElement] | None,
        Field(
            deprecated=True,
            description='Visual components to render (DEPRECATED: use surface instead)',
        ),
    ] = None


class SiSendMessageResponse(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    errors: list[error.Error] | None = None
    ext: ext_1.ExtensionObject | None = None
    handoff: Annotated[
        Handoff | None, Field(description='Handoff request when session_status is pending_handoff')
    ] = None
    mcp_resource_uri: Annotated[
        str | None,
        Field(
            description='MCP resource URI for hosts with MCP Apps support (e.g., ui://si/session-abc123)'
        ),
    ] = None
    response: Annotated[Response | None, Field(description="Brand agent's response")] = None
    session_id: Annotated[str, Field(description='Session identifier')]
    session_status: Annotated[SessionStatus, Field(description='Current session status')]
