# This file was auto-generated by Fern from our API Definition.

from .conversation_base import ConversationBase
import typing_extensions
from .entity_id import EntityId
from ...core.serialization import FieldMetadata
import pydantic
import typing
from .conversation_message_response import ConversationMessageResponse
from .conversation_analysis import ConversationAnalysis
from ...core.pydantic_utilities import IS_PYDANTIC_V2


class ConversationResponse(ConversationBase):
    """
    Examples
    --------
    from mavenagi.commons import (
        BotResponse_Text,
        BotResponseMetadata,
        ConversationAnalysis,
        ConversationMessageResponse_Bot,
        ConversationMessageResponse_User,
        ConversationResponse,
        EntityId,
        EntityIdBase,
        UserMessageAttachment,
    )

    ConversationResponse(
        conversation_id=EntityId(
            reference_id="conversation-0",
            app_id="myapp",
            organization_id="acme",
            agent_id="support",
            type="CONVERSATION",
        ),
        analysis=ConversationAnalysis(
            resolution_status="Resolved",
            sentiment="POSITIVE",
        ),
        messages=[
            ConversationMessageResponse_User(
                user_message_type="USER",
                conversation_message_id=EntityId(
                    reference_id="message-0",
                    app_id="myapp",
                    organization_id="acme",
                    agent_id="support",
                    type="CONVERSATION_MESSAGE",
                ),
                user_id=EntityIdBase(
                    reference_id="user-0",
                ),
                text="How do I reset my password?",
                attachments=[
                    UserMessageAttachment(
                        url="https://example.com/attachment-0",
                    )
                ],
            ),
            ConversationMessageResponse_Bot(
                bot_message_type="BOT_RESPONSE",
                conversation_message_id=EntityId(
                    reference_id="message-1",
                    app_id="myapp",
                    organization_id="acme",
                    agent_id="support",
                    type="CONVERSATION_MESSAGE",
                ),
                responses=[
                    BotResponse_Text(
                        text="Hi! Go to acme.com/reset-password",
                    )
                ],
                metadata=BotResponseMetadata(
                    followup_questions=["What if I did not get the reset email?"],
                    sources=[],
                ),
            ),
        ],
    )
    """

    conversation_id: typing_extensions.Annotated[EntityId, FieldMetadata(alias="conversationId")] = pydantic.Field()
    """
    The ID that uniquely identifies this conversation
    """

    messages: typing.List[ConversationMessageResponse] = pydantic.Field()
    """
    The messages in the conversation
    """

    analysis: ConversationAnalysis = pydantic.Field()
    """
    An analysis of the conversation.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
