package app.closer.domain.model

data class QuestionThread(
    val id: String = "",
    val coupleId: String = "",
    val questionId: String = "",
    val categoryId: String = "",
    val status: QuestionThreadStatus = QuestionThreadStatus.NOT_STARTED,
    val currentIndex: Int = 0,
    val createdAt: Long = 0L,
    val updatedAt: Long = 0L
)

enum class QuestionThreadStatus {
    NOT_STARTED,
    ANSWERED_BY_ONE,
    REVEALED,
    COMPLETED;

    fun toFirestoreValue(): String = name.lowercase()

    companion object {
        fun fromFirestoreValue(value: String): QuestionThreadStatus = when (value) {
            "answered_by_one" -> ANSWERED_BY_ONE
            "revealed" -> REVEALED
            "completed" -> COMPLETED
            else -> NOT_STARTED
        }
    }
}
