package com.craigvg.lichun_android.domain.models import kotlinx.serialization.Serializable /** * Question and answer models for game events * Ported from iOS Question.swift */ /** * Question representing game events requiring player choices */ @Serializable data class Question( val id: String, val question: String, val answers: List, val characters: List? = null, val image: String? = null ) { val eventId: String get() = id } /** * Answer option for questions */ @Serializable data class AnswerOption( val option: String, val id: String? = null, val data: String? = null, val energyCost: Int? = null, val moneyCost: Double? = null, val diamondCost: Int? = null ) { /** * Check if the player can afford this option */ fun canAfford(energy: Int, money: Double, diamonds: Int): Boolean { return energy >= (energyCost ?: 0) && money >= (moneyCost ?: 0.0) && diamonds >= (diamondCost ?: 0) } /** * Total cost description */ val costDescription: String get() { val costs = mutableListOf() energyCost?.let { if (it > 0) costs.add("$it Energy") } moneyCost?.let { if (it > 0) costs.add("$$it") } diamondCost?.let { if (it > 0) costs.add("$it Diamonds") } return costs.joinToString(" + ") } val choiceId: String? get() = id?.trim()?.takeIf { it.isNotEmpty() } }