package com.sipai.jspatrol.Loading;

import android.content.Context;

import com.sipai.jspatrol.Base.BasePresenter;
import com.sipai.jspatrol.Bean.LoginInfo;

import java.util.HashMap;

/**
 * created by lvliming on 2019/9/11
 */
public class LoadingPresenter extends BasePresenter<LoadingActivity, LoadingModel, LoadingContract.Presenter> {

    @Override
    public LoadingContract.Presenter getContract() {
        return new LoadingContract.Presenter<LoginInfo>(){
            @Override
            public void requestData(Context context, HashMap<String, String> map, String server, String url) {
                try {
                    m.getContract().executeData(context,map,server,url);
                }catch (Exception e){
                    e.printStackTrace();
                }
            }

            @Override
            public void responseResult(LoginInfo item) {
                getView().getContract().handlerResult(item);
            }

            @Override
            public void requestComList(Context context, HashMap<String, String> map, String server, String url, String token) {
                try {
                    m.getContract().executeComData(context,map,server,url,token);
                }catch (Exception e){
                    e.printStackTrace();
                }
            }

            @Override
            public void responseComResult(String result,String bizs) {
                getView().getContract().handlerComResult(result,bizs);
            }
        };
    }

    @Override
    public LoadingModel getModel() {
        return new LoadingModel(this);
    }
}
