
const Api = require('../net/Api');

class HomeApi {

    /**
     * 获取目标用户的建筑
     * @param targetUid [long] 目标用户，当前用户就传自己的uid 的值
     * @param cityId [long] 城市 id
     */
    static getUserBuildings(targetUid, cityId, success, fail) {

        let url = "/building/getUserBuildings.do";

        let data = {
            targetUid: targetUid,
            cityId: cityId,
        };

        let requestBody = {
            url: url,
            data: data,
            success: success,
            fail: fail,
            complete: () => {

            }
        };

        Api.httpGet(requestBody);
    }

    /**
     *  升级建筑
     *  @param buildingId   [int] 建筑Id
     *  @param cityId       [int] 城市id
     *  @param grossIncome  [int] 当前总金币数
     *  @param grossRate    [int] 自动收入金额
     *  @param level        [int] 建筑等级
     *  @param stars        [int] 星星数
     *
     * */
    static buildingUpGrade(formmInfoJson, success, fail) {

        let url = "/building/upGrade.do";

        let data = {
            formInfo: formmInfoJson,
        };

        let requestBody = {
            url: url,
            data: data,
            success: success,
            fail: fail,
            complete: () => {

            }
        };

        Api.httpPost(requestBody);
    }

    /**
     *  获取首页好友列表
     * */
    static getFriends(success, fail) {
    
        let url = "/friend/getIndexList.do";

        let data = {};

        let requestBody = {
            url: url,
            data: data,
            success: success,
            fail: fail,
            complete: () => {

            }
        };

        Api.httpGet(requestBody);
    }

    /**
     * 主界面艺人管理列表
     */
    static getFriendManageList(success, fail) {

        let url = "/friend/getManageList.do";

        let data = {};

        let requestBody = {
            url: url,
            data: data,
            success: success,
            fail: fail,
            complete: () => {

            }
        };

        Api.httpGet(requestBody);
    }

    /**
     * 上报接口
     * @param {*} reportFormInfo {"grossIncome":1000,"grossRate":10000,"stars":1}
     * @param {*} success 
     * @param {*} fail 
     */
    static userReportGross(reportFormInfo, success, fail) {

        let url = "/building/report.do";

        let data = {
            reportFormInfo: reportFormInfo,
        };

        let requestBody = {
            url: url,
            data: data,
            success: success,
            fail: fail,
            complete: () => {

            }
        };

        Api.httpPost(requestBody);
    }

    /**
     * 获取好友艺人列表
     * @param {int} fid 好友uid 
     * @param {*} success 
     * @param {*} fail 
     */
    static friendGetArtists(fid, success, fail) {

        let url = "/friend/getArtists.do";

        let data = {
            fid: fid,
        };

        let requestBody = {
            url: url,
            data: data,
            success: success,
            fail: fail,
            complete: () => {

            }
        };

        Api.httpGet(requestBody);
    }
}

module.exports = HomeApi;