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

class PackApi {
    /*
    *   获取用户插卡信息
    *   @param uid   [string] 用户id
    * */
    static getUserCardsInfo(uid, success, fail) {
        let url = "/item/getCards.do";

        let data = {
            targetUid: uid
        };

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

            }
        };

        Api.httpGet(requestBody);
    }

    static postInsertCard(uid, itemId, success, fail) {
        let url = "/item/insertCard.do";

        let data = {
            targetUid: uid,
            itemId: itemId
        };

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

            }
        };

        Api.httpPost(requestBody);
    }

    static postUnloadCard(uid, itemId, success, fail) {
        let url = "/item/unload.do";

        let data = {
            targetUid: uid,
            itemId: itemId,
        };

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

            }
        };

        Api.httpPost(requestBody);
    }

    static getUserPackInfo(success, fail) {
        let url = "/user/getUserPackInfo.do";

        let data = {};

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

            }
        };

        Api.httpGet(requestBody);
    };
}

module.exports = PackApi;