package com.example.quiz.viewModel;

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

import com.example.quiz.data.model.PagedModel;
import com.example.quiz.data.model.PointDeVente;
import com.example.quiz.data.repository.PointDeVenteRepository;
import com.example.quiz.utils.Result;

import javax.inject.Inject;

import dagger.hilt.android.lifecycle.HiltViewModel;

@HiltViewModel
public class PointDeVenteViewModel extends ViewModel {
    private final PointDeVenteRepository pointDeVenteRepository;
    private LiveData<Result<PagedModel<PointDeVente>>> pointsDeVente;

    private LiveData<Result<PointDeVente>> pointDeVenteById;

    @Inject
    public PointDeVenteViewModel(PointDeVenteRepository pointDeVenteRepository){
        this.pointDeVenteRepository = pointDeVenteRepository;
    }

    public LiveData<Result<PagedModel<PointDeVente>>> setPointsDeVente(String search){
        this.pointsDeVente = pointDeVenteRepository.getPointsDeVente(search);
        return this.pointsDeVente;
    }

    public LiveData<Result<PointDeVente>> getPointDeVenteById(String id) {
        pointDeVenteById = pointDeVenteRepository.getPointDeVenteById(id);
        return pointDeVenteById;
    }
}
