import Foundation

protocol RitualStoreProviding {
    var rituals: [Ritual] { get }
    var currentRituals: [Ritual] { get }
    var pastRituals: [Ritual] { get }
    var activeRitual: Ritual? { get }
    var todayDisplayString: String { get }
    var activeRitualProgress: Double { get }
    func ritualProgress(for ritual: Ritual) -> Double
    func habits(for ritual: Ritual) -> [ArcHabit]
    func isHabitCompletedToday(_ habit: ArcHabit) -> Bool
    func toggleHabitCompletion(_ habit: ArcHabit)
    func ritualDayIndex(for ritual: Ritual) -> Int
    func ritualDayLabel(for ritual: Ritual) -> String
    func completionSummary(for ritual: Ritual) -> String
    func insightCards() -> [InsightCard]
    func createQuickRitual()
    func ritualsForToday() -> [Ritual]
    func currentRitualsGroupedByTime() -> [(timeOfDay: TimeOfDay, rituals: [Ritual])]
    
    // Arc Management
    func arcsActive(on date: Date) -> [RitualArc]
    func habitsActive(on date: Date) -> [ArcHabit]
    func renewArc(for ritual: Ritual, durationDays: Int?, copyHabits: Bool)
    func startNewArc(for ritual: Ritual, durationDays: Int?)
    func endArc(for ritual: Ritual)
    
    // Enhanced Analytics
    func weeklyAverageForDate(_ date: Date) -> Double
    func streakIncluding(_ date: Date) -> Int?
    func daysRemaining(for ritual: Ritual) -> Int
    func streakForRitual(_ ritual: Ritual) -> Int
    func habitCompletionRates(for ritual: Ritual) -> [(habit: ArcHabit, rate: Double)]
    func milestonesAchieved(for ritual: Ritual) -> [Milestone]
    func weekOverWeekChange() -> Double
    func motivationalMessage(for rate: Double) -> String
    func insightContext() -> InsightContext
    func completionRate(for date: Date, ritual: Ritual?) -> Double
}
