package app.closer.domain.repository

import app.closer.domain.model.DatePlan
import app.closer.domain.model.DatePlanPreference
import app.closer.domain.model.DatePlanSuggestion
import kotlinx.coroutines.flow.Flow

/**
 * Repository for the Date Builder feature.
 *
 * Responsibilities:
 * - Store partner preferences locally (Room)
 * - Assemble complete date plans from preferences
 * - Sync plans to Firestore when shared/scheduled
 */
interface DatePlanRepository {

    // ─── Preference methods ──────────────────────────────────────────────────

    /** Get a partner's preference for a date idea. */
    suspend fun getPreference(coupleId: String, dateIdeaId: String): DatePlanPreference?

    /** Record or update a partner's preference. */
    suspend fun savePreference(preference: DatePlanPreference)

    /** Observe all preferences for a couple. */
    fun observePreferences(coupleId: String): Flow<List<DatePlanPreference>>

    // ─── Plan methods ────────────────────────────────────────────────────────

    /** Get a date plan by ID. */
    suspend fun getPlan(planId: String): DatePlan?

    /** Get all plans for a couple. */
    suspend fun getPlansForCouple(coupleId: String): List<DatePlan>

    /** Get plans for a couple by status. */
    suspend fun getPlansByStatus(coupleId: String, status: String): List<DatePlan>

    /** Create or update a date plan. */
    suspend fun savePlan(plan: DatePlan)

    /** Update plan status (draft → planned → completed). */
    suspend fun updatePlanStatus(planId: String, status: String)

    /** Delete a date plan. */
    suspend fun deletePlan(planId: String)

    // ─── Builder methods ─────────────────────────────────────────────────────

    /** Assemble a date plan suggestion from partner preferences. */
    suspend fun assemblePlanSuggestion(
        coupleId: String,
        dateIdeaId: String
    ): DatePlanSuggestion?
}
