package com.kfzs.duanduan.bll;

import com.android.volleyplus.Response;
import com.kfzs.appstore.utils.restful.KFZSNetwork;
import com.kfzs.duanduan.KFZSApp;
import com.sheep.jiuyan.samllsheep.R;
import com.kfzs.duanduan.utils.dlg.HelperUtils;
import com.kfzs.duanduan.utils.net.APIRequestInstance;
import com.kfzs.duanduan.utils.net.APIRequestV2;
import com.kfzs.duanduan.bean.BaseMsg;

import java.util.HashMap;

/**
 * @ Created by Dlg
 * @ <p>TiTle:  GameListBll</p>
 * @ <p>Description:各种游戏列表相关的业务类，都全放这儿吧</p>
 * @ <p>Description:以后所有请求业务类全放bll包名下规范就好了。。。</p>
 * @ date:  2017/12/13 11:34
 * @ QQ:    315096953
 */

public class GameListBll {


    /**
     * 获取游戏推荐列表
     *
     * @param page     页面，从1开始
     * @param per_page 每页显示个数
     * @param listener 回调
     */
    public void getNewGameRecommendList(Integer page, Integer per_page, Response.Listener<BaseMsg> listener) {
        HashMap<String, String> hashMap = new HashMap<>();
        if (page != null) {
            hashMap.put("page", (page < 1 ? 1 : page) + "");
        }
        if (per_page != null) {
            hashMap.put("per_page", (per_page < 1 ? 10 : per_page) + "");
        }

        APIRequestV2 apiRequestV2 = APIRequestInstance.getReqUrlV2("getNewGameRecommendList",
                UrlBll.V2.NEW_GAME_RECOMMEND, hashMap, listener,
                HelperUtils.makeErr(KFZSApp.context.getString(R.string.network_conf_network)));
        KFZSNetwork.addRequest(apiRequestV2);
    }


    /**
     * 猜你喜欢接口
     *
     * @param listener
     */
    public void getGuessYouLike(Response.Listener<BaseMsg> listener) {
        APIRequestV2 apiRequestV2 = APIRequestInstance.getReqUrlV2("getGuessYouLike",
                UrlBll.V2.GUESS_YOU_LIKE, null, listener,
                HelperUtils.makeErr(KFZSApp.context.getString(R.string.network_conf_network)));
        KFZSNetwork.addRequest(apiRequestV2);
    }


    /**
     * 取特别推荐的接口
     *
     * @param listener
     */
    public void getSpecialRecommend(Response.Listener<BaseMsg> listener) {
        APIRequestV2 apiRequestV2 = APIRequestInstance.getReqUrlV2("getSpecialRecommend",
                UrlBll.V2.SPECIAL_RECOMMEND, null, listener,
                HelperUtils.makeErr(KFZSApp.context.getString(R.string.network_conf_network)));
        KFZSNetwork.addRequest(apiRequestV2);
    }


    /**
     * 获取角色扮演列表和二次元以及专题列表
     *
     * @param listener
     */
    public void getCartonRPGEtc(Response.Listener<BaseMsg> listener) {
        APIRequestV2 apiRequestV2 = APIRequestInstance.getReqUrlV2("getSpecialRecommend",
                UrlBll.V2.CATE_RECOMMEND, null, listener,
                HelperUtils.makeErr(KFZSApp.context.getString(R.string.network_conf_network)));
        KFZSNetwork.addRequest(apiRequestV2);
    }

    /**
     * 新游预约推荐列表获取
     *
     * @param listener
     */
    public void getNewGameBook(Response.Listener<BaseMsg> listener) {
        APIRequestV2 apiRequestV2 = APIRequestInstance.getReqUrlV2("getSpecialRecommend",
                UrlBll.V2.NEW_GAME_BOOK, null, listener,
                HelperUtils.makeErr(KFZSApp.context.getString(R.string.network_conf_network)));
        KFZSNetwork.addRequest(apiRequestV2);
    }
}
