package com.ardraw.ardrawingflow.ui.viewmodel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;

import com.ardraw.ardrawingflow.data.database.dao.FlowDataDao;
import com.ardraw.ardrawingflow.data.database.AppDatabase;
import com.ardraw.ardrawingflow.data.database.entity.FlowData;
import com.ardraw.ardrawingflow.data.repository.FlowRepository;

import java.util.List;

public class FlowViewModel extends AndroidViewModel {
    private final FlowRepository flowRepository;

    public FlowViewModel(@NonNull Application application) {
        super(application);
        FlowDataDao flowDataDao = AppDatabase.getInstance(application).flowDataDao();
        flowRepository = new FlowRepository(flowDataDao);
    }

    public void insert(FlowData flowData) {
        flowRepository.insert(flowData);
    }

    public void delete(FlowData flowData) {
        flowRepository.delete(flowData);
    }

    public LiveData<List<FlowData>> getLike() {
        return flowRepository.getLike();
    }

    public LiveData<List<FlowData>> getDataByName(String name) {
        return flowRepository.getDataByName(name);
    }

    public LiveData<List<FlowData>> getMinId() {
        return flowRepository.getMinId();
    }

    public LiveData<List<FlowData>> getAddLiveData() {
        return flowRepository.getAddLiveData();
    }

    public List<FlowData> getAdd() {
        return flowRepository.getAdd();
    }

}
