package com.ahau.againstpestinfo.model;

import android.util.Log;

import com.ahau.againstpestinfo.HttpProcessor.HttpCallback;
import com.ahau.againstpestinfo.HttpProcessor.HttpHelper;
import com.ahau.againstpestinfo.bean.AreaidBean;
import com.ahau.againstpestinfo.bean.ResearchPeopleBean;
import com.ahau.againstpestinfo.utils.URLUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * 注释:
 *
 * @author fanchunchun
 * @date 2018/4/20
 */

public class ISearchModelImpl implements ISearchModel {
    @Override
    public void getResearName(final ResearNameListener researNameListener) {
        Map<String, Object> params = new HashMap<>();

        HttpHelper.obtain().get(URLUtils.defaultUrl + "/resh", params, new HttpCallback<ResearchPeopleBean>() {

            @Override
            public void onSuccess(ResearchPeopleBean researchPeopleBean) {
                ArrayList<String> mResearchPeopleList;

                mResearchPeopleList = (ArrayList<String>) researchPeopleBean.getResearch();

                Log.i("TAG",researchPeopleBean.toString());

                researNameListener.onComplete(mResearchPeopleList);
            }
        });
    }

    @Override
    public void getAreaid(final DateListener dateListener) {
        Map<String, Object> params = new HashMap<>();

        HttpHelper.obtain().get(URLUtils.defaultUrl + "/areaid", params, new HttpCallback<AreaidBean>() {

            @Override
            public void onSuccess(AreaidBean researchPeopleBean) {
                ArrayList<String> mResearchPeopleList;

                mResearchPeopleList = (ArrayList<String>) researchPeopleBean.getAreaid();

                Log.i("TAG",researchPeopleBean.toString());

                dateListener.onComplete(mResearchPeopleList);
            }
        });
    }

}
