package com.craigvg.lichun_android.domain.models import kotlinx.serialization.Serializable import java.util.UUID /** * Conversation-related models * Ported from iOS Conversation.swift */ /** * Conversation class representing available conversation options */ @Serializable data class ConversationClass( val id: String = UUID.randomUUID().toString(), val fname: String, val button: String ) /** * Individual conversation message */ @Serializable data class ConversationMessage( val id: String, val message: String, val sentiment: String = "", val answerOptions: List? = null, val sender: String? = null, val datetime: String, val date: String, val time: String ) { /** * Whether this is a message from the player */ val isFromPlayer: Boolean get() = sender == "player" || sender == null /** * Sentiment indicator for message display */ val sentimentEmoji: String get() = when (sentiment.lowercase()) { "positive" -> "smile" "negative" -> "frown" "neutral" -> "meh" else -> "" } } /** * Conversation object containing full conversation thread */ @Serializable data class ConversationObj( val id: String, val type: String = "conversationEvent", val cType: String? = null, val character: String? = null, val conversation: List = emptyList(), val question: Int = 0 ) { /** * Last message in conversation */ val lastMessage: ConversationMessage? get() = conversation.lastOrNull() /** * Preview text for conversation list */ val previewText: String get() = lastMessage?.message?.take(50) ?: "" /** * Number of messages in conversation */ val messageCount: Int get() = conversation.size }