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


class Reason(Enum):
    handoff_transaction = 'handoff_transaction'
    handoff_complete = 'handoff_complete'
    user_exit = 'user_exit'
    session_timeout = 'session_timeout'
    host_terminated = 'host_terminated'


class Action(Enum):
    purchase = 'purchase'
    subscribe = 'subscribe'


class TransactionIntent(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    action: Action | None = None
    product: Annotated[dict[str, Any] | None, Field(description='Product/service details')] = None


class TerminationContext(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    cause: Annotated[
        str | None, Field(description='For host_terminated - why host ended session')
    ] = None
    summary: Annotated[str | None, Field(description='Summary of the conversation')] = None
    transaction_intent: Annotated[
        TransactionIntent | None,
        Field(description='For handoff_transaction - what user wants to buy'),
    ] = None


class SiTerminateSessionRequest(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    ext: ext_1.ExtensionObject | None = None
    reason: Annotated[Reason, Field(description='Reason for termination')]
    session_id: Annotated[str, Field(description='Session identifier to terminate')]
    termination_context: Annotated[
        TerminationContext | None, Field(description='Context for the termination')
    ] = None
