package com.example.elva.data.repository

import com.example.elva.data.models.dashboard.DashboardSummary
import com.example.elva.data.local.HealthDataStore
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class DashboardRepository @Inject constructor(
    private val healthDataStore: HealthDataStore
) {
    suspend fun getDashboardSummary(): DashboardSummary {
        val water = healthDataStore.getTodayWaterIntake()
        val waterGoal = healthDataStore.getWaterGoal()
        val calories = healthDataStore.getTodayCalories()
        val caloriesGoal = healthDataStore.getCaloriesGoal()
        val sleepEntry = healthDataStore.getTodaySleep()
        val weightEntry = healthDataStore.getLatestWeight()

        return DashboardSummary(
            cycleDay = 0, // TODO: Calculate from period data
            nextPeriodDays = 0, // TODO: Calculate from period data
            water = water,
            waterGoal = waterGoal,
            calories = calories,
            caloriesGoal = caloriesGoal,
            sleep = sleepEntry?.hours ?: 0f,
            weight = weightEntry?.weight ?: 0f
        )
    }
}

