package com.example.quiz.viewModel;


import android.util.Log;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;


import com.example.quiz.data.ActivityLogger;
import com.example.quiz.data.dao.UserActivityLogDao;
import com.example.quiz.data.database.DatabaseClient;
import com.example.quiz.data.entity.Logs;

import java.util.List;
import java.util.concurrent.Executors;

import javax.inject.Inject;

import dagger.hilt.android.lifecycle.HiltViewModel;

@HiltViewModel
public class LogsViewModel extends ViewModel {
    private MutableLiveData<List<Logs>> todayLogs = new MutableLiveData<List<Logs>>(null);
    private UserActivityLogDao dao;

    @Inject
    public LogsViewModel(UserActivityLogDao dao) {
        this.dao = dao;
        ActivityLogger.init(dao);
    }

    public LiveData<List<Logs>> getTodayLogs() {
        return dao.getTodayLogs();
    }

    public void insertLog(String userId, String action, String description, Long timestamp){
        ActivityLogger.log(userId, action, description, timestamp);
    }
}
