package com.example.quiz.data;

import android.os.AsyncTask;

import com.example.quiz.data.dao.UserActivityLogDao;
import com.example.quiz.data.entity.Logs;

import java.util.concurrent.Executors;

public class ActivityLogger {
    public static UserActivityLogDao dao;

    public static void init(UserActivityLogDao iDao){
         dao = iDao;
    }

    public static void log(String userId, String activity, String description, Long timestamp){
        Executors.newSingleThreadExecutor().execute(()->{
            Logs userLog = new Logs();
            userLog.setUserId(userId);
            userLog.setAction(activity);
            userLog.setDescription(description);
            userLog.setTimestamp(timestamp);
            dao.insertLog(userLog);
        });
    }

}
