package com.gh.gamecenter.common.baselist;

import android.app.Application;

import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;

import java.util.List;

public abstract class BaseListViewModel<ID> extends AndroidViewModel {

    protected String mEntrance = ""; // 页面路径

    protected final MutableLiveData<LoadStatus> mLoadStatusLiveData = new MutableLiveData<>();

    protected final MediatorLiveData<List<ID>> mResultLiveData = new MediatorLiveData<>(); // 最后输出到页面的数据

    @MainThread
    public abstract void load(LoadType loadType);

    public BaseListViewModel(@NonNull Application application) {
        super(application);
    }

    public LiveData<List<ID>> getObsListData() {
        return mResultLiveData;
    }

    public LiveData<LoadStatus> getLoadStatusLiveData() {
        return mLoadStatusLiveData;
    }

}
