package app.closer.domain.model

/**
 * A complete date plan assembled from partner preferences.
 *
 * Generated by the Builder when both partners have contributed preferences.
 * Synced to Firestore under couples/{coupleId}/date_plans/{planId}.
 *
 * @property id Firestore document ID.
 * @property coupleId The couple that owns this plan.
 * @property dateIdeaId Reference to the selected date idea.
 * @property scheduledDate Unix timestamp for the planned date.
 * @property scheduledTime Time string (e.g., "7:00 PM").
 * @property budget Budget amount in cents.
 * @property duration Duration label (e.g., "2–3 hours").
 * @property status Draft, planned, or completed.
 * @property activity Recommended activity description.
 * @property food Recommended food/dining option.
 * @property conversationPrompts List of question pack IDs or prompt strings.
 * @property optionalChallenge Optional challenge suggestion.
 * @property createdAt Server timestamp of creation.
 * @property updatedAt Server timestamp of last update.
 */
data class DatePlan(
    val id: String = "",
    val coupleId: String = "",
    val dateIdeaId: String = "",
    val scheduledDate: Long = 0L,
    val scheduledTime: String = "",
    val budget: Int = 0,
    val duration: String = "",
    val status: DatePlanStatus = DatePlanStatus.DRAFT,
    val activity: String = "",
    val food: String = "",
    val conversationPrompts: List<String> = emptyList(),
    val optionalChallenge: String? = null,
    val createdAt: Long = 0L,
    val updatedAt: Long = 0L
)

enum class DatePlanStatus {
    DRAFT,
    PLANNED,
    COMPLETED;

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

    companion object {
        fun fromFirestoreValue(value: String): DatePlanStatus = when (value) {
            "draft" -> DRAFT
            "planned" -> PLANNED
            "completed" -> COMPLETED
            else -> DRAFT
        }
    }
}
