package com.android.chmo.http.service;

import com.android.chmo.app.ChmoApplication;
import com.android.chmo.constant.Constants;
import com.android.chmo.http.HttpApi;
import com.android.chmo.http.RequestCallback;
import com.android.chmo.model.LoginUser;

import org.xutils.common.Callback;
import org.xutils.http.RequestParams;

/**
 * Created by Administrator on 2018/8/2.
 */

public class ModelService {
    private static RequestParams getRequestParams() {
        RequestParams params = new RequestParams(HttpApi.BASE_URL + "modelInfo");
        return params;
    }

    /**
     * 关注列表
     */
    public static Callback.Cancelable getFollowList(String pk, int pageNo, RequestCallback callback) {
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "doGetModelFan");
        params.addQueryStringParameter("PK", pk);
        params.addQueryStringParameter("index", pageNo + "");
        params.addQueryStringParameter("size", Constants.PAGE_SIZE + "");
        return HttpApi.GET(params, callback);
    }

    /**
     * 艺人列表
     */
    public static Callback.Cancelable getModelList(String search, int pageNo, RequestCallback callback) {
        LoginUser user = ChmoApplication.getApp().getLoginUser();
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "dogetQueryModel");
        params.addQueryStringParameter("LikeName", search);
        params.addQueryStringParameter("memberpk", user.pk);
        params.addQueryStringParameter("index", pageNo + "");
        params.addQueryStringParameter("size", Constants.PAGE_SIZE + "");

        return HttpApi.GET(params, callback);
    }

    /**
     * 推荐列表
     */
    public static Callback.Cancelable getRecommedList(int pageNo, RequestCallback callback) {
        LoginUser user = ChmoApplication.getApp().getLoginUser();
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "dogetmodel");
        params.addQueryStringParameter("memberpk", user.pk);
        params.addQueryStringParameter("index", pageNo + "");
        params.addQueryStringParameter("size", Constants.PAGE_SIZE + "");

        return HttpApi.GET(params, callback);
    }

    /**
     * 经纪人列表
     */
    public static Callback.Cancelable getBrokerList(int pageNo, RequestCallback callback) {
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "doQryBroke");
        params.addQueryStringParameter("index", pageNo + "");
        params.addQueryStringParameter("size", Constants.PAGE_SIZE + "");
        return HttpApi.GET(params, callback);
    }

    /**
     * 经纪人下的模特
     */
    public static Callback.Cancelable getBrokerModels(String brokerPK, int pageNo, RequestCallback callback) {
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "doQryModel");
        params.addQueryStringParameter("BrokePK", brokerPK);
        params.addQueryStringParameter("memberpk", brokerPK);
        params.addQueryStringParameter("index", pageNo + "");
        params.addQueryStringParameter("size", Constants.PAGE_SIZE + "");
        return HttpApi.GET(params, callback);
    }


    /**
     * 获取模特信息
     */
    public static Callback.Cancelable getModelInfo(String modelPk, RequestCallback callback) {
        LoginUser user = ChmoApplication.getApp().getLoginUser();
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "doModelInfoByPk");
        params.addQueryStringParameter("ModelPK", modelPk);
        params.addQueryStringParameter("memberpk", user.pk);
        return HttpApi.GET(params, callback);
    }


    public static Callback.Cancelable getModelDetailInfo(String modelPk, RequestCallback callback) {
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "findModelAllInfo");
        params.addQueryStringParameter("ModelPK", modelPk);
        return HttpApi.GET(params, callback);
    }

    /**
     * 获取模特荣誉信息
     */
    public static Callback.Cancelable getModelHonor(String modelPk, RequestCallback callback) {
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "doGetHonorName");
        params.addQueryStringParameter("ModelPK", modelPk);
        return HttpApi.GET(params, callback);
    }

    /**
     * 获取模特技能信息
     */
    public static Callback.Cancelable getModelSkill(String modelPk, RequestCallback callback) {
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "doGetPrice");
        params.addQueryStringParameter("ModelPK", modelPk);
        return HttpApi.GET(params, callback);
    }

    /**
     * 获取模特标签
     */
    public static Callback.Cancelable getModelLabel(String modelPk, RequestCallback callback) {
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "doGetModelFigure");
        params.addQueryStringParameter("ModelPK", modelPk);
        return HttpApi.GET(params, callback);
    }

    public static Callback.Cancelable getLabels(RequestCallback callback) {
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "dogetfigures");
        return HttpApi.GET(params, callback);
    }

    public static Callback.Cancelable getAllSkills(RequestCallback callback) {
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "doqryskillfigure");
        return HttpApi.GET(params, callback);
    }

    public static Callback.Cancelable getModelByLabel(String labelPk, int pageNo, RequestCallback callback) {
        LoginUser user = ChmoApplication.getApp().getLoginUser();
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "doqryskillmodel");
        params.addQueryStringParameter("SkillPK", labelPk);
//        params.addQueryStringParameter("memberpk", user.pk);
        params.addQueryStringParameter("index", pageNo + "");
        params.addQueryStringParameter("size", Constants.PAGE_SIZE + "");
        return HttpApi.GET(params, callback);
    }


    public static Callback.Cancelable setFollow(String modelPk, int type, RequestCallback callback) {
        LoginUser user = ChmoApplication.getApp().getLoginUser();
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "attention");
        params.addQueryStringParameter("memberPk", user.pk);
        params.addQueryStringParameter("modelPk", modelPk);
        params.addQueryStringParameter("type", type + "");
        return HttpApi.GET(params, callback);
    }


    // 获取模特私密空间
    public static Callback.Cancelable modelZone(String modelPk,int page, RequestCallback callback) {
        LoginUser user = ChmoApplication.getApp().getLoginUser();
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "doGetPrivate");
        params.addQueryStringParameter("ModelPK", modelPk);
        params.addQueryStringParameter("memberpk", user.pk);
        params.addQueryStringParameter("index", page + "");
        params.addQueryStringParameter("size", Constants.PAGE_SIZE + "");
        return HttpApi.GET(params, callback);
    }

    public static Callback.Cancelable goodModelZone(String pk, RequestCallback callback) {
        LoginUser user = ChmoApplication.getApp().getLoginUser();
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "doPraisePrivate");
        params.addQueryStringParameter("PrivatePK", pk);
        params.addQueryStringParameter("PK", user.pk);
        return HttpApi.GET(params, callback);
    }

    /**
     * 获取模特视频单价
     */
    public static Callback.Cancelable getModelVideoPrice(String pk, RequestCallback callback) {
        LoginUser user = ChmoApplication.getApp().getLoginUser();
        RequestParams params = getRequestParams();
        params.addQueryStringParameter("action", "doGetModelVPrice");
        params.addQueryStringParameter("memberpk", pk);
        return HttpApi.GET(params, callback);
    }


}
