package com.example.lexilearn.ui.views.pHome

import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.example.lexilearn.data.model.MaterialDataModel
import com.example.lexilearn.data.model.QuizState
import com.example.lexilearn.data.repository.MaterialRepository
import com.example.lexilearn.data.repository.QuizRepository

class HomeViewModel(application: Application) : AndroidViewModel(application) {
    private val _materialRepository = MaterialRepository(application)
    private val _quizRepository = QuizRepository()

    fun prepareCompetitionQuiz(callback: (List<MaterialDataModel>) -> Unit) {
        _materialRepository.getAllMaterialData("all") { materials ->
            _quizRepository.getRandomMaterials(10, materials) { randomData ->
                randomData.forEach { println(it) }
                callback(randomData)
            }
        }
    }
}