package com.example.quiz.viewModel;

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

import com.example.quiz.data.model.Tpe;
import com.example.quiz.data.model.TpeResponse;
import com.example.quiz.data.repository.TpeRepository;
import com.example.quiz.utils.Result;

import javax.inject.Inject;

import dagger.hilt.android.lifecycle.HiltViewModel;

@HiltViewModel
public class TpeViewModel extends ViewModel {
    private TpeRepository tpeRepository;

    private LiveData<Result<TpeResponse>> tpeLiveData;

    private LiveData<Result<TpeResponse>> tpeByIdLiveData;

    @Inject
    public TpeViewModel(TpeRepository repository){
        this.tpeRepository = repository;
    }

    public LiveData<Result<TpeResponse>> createTpe(Tpe tpe){
        tpeLiveData = tpeRepository.createTpe(tpe);
        return tpeLiveData;
    }

    public LiveData<Result<TpeResponse>> getTpeById(String id){
        tpeByIdLiveData = tpeRepository.getTpeById(id);
        return tpeByIdLiveData;
    }
}
