/**
 * 排行榜模块 - 排行榜相关接口
 */
import RequestManager from '../request';

/**
 * 获取排行榜列表
 * @param {String} type 排行榜类型 (invite-邀请榜, consume-消费榜, record-中奖榜, dadajuan-哈尼券榜)
 * @param {Number} page 页码
 * @returns {Promise} 排行榜数据
 */
export const getRankList = async (type = 'record', page = 1) => {
    return await RequestManager.get('/getRankList', {
        type,
        page
    });
};

/**
 * 获取中奖记录排行榜
 * @param {Number} page 页码
 * @returns {Promise} 排行榜数据
 */
export const getRecordRank = async (page = 1) => {
    return await RequestManager.get('/record', {
        page
    });
};

/**
 * 获取邀请排行榜
 * @param {Number} page 页码
 * @returns {Promise} 排行榜数据
 */
export const getInviteRank = async (page = 1) => {
    return await RequestManager.get('/getRankList', {
        type: 'invite',
        page
    });
};

/**
 * 获取周榜单
 * @param {Number} page 页码
 * @returns {Promise} 排行榜数据
 */
export const getWeekRank = async (page = 1) => {
    return await RequestManager.get('/rank_week', {
        page
    }, true);
};

/**
 * 获取月榜单
 * @param {Number} page 页码
 * @returns {Promise} 排行榜数据
 */
export const getMonthRank = async (page = 1) => {
    return await RequestManager.get('/rank_month', {
        page
    }, true);
};

/**
 * 获取哈尼券排行榜
 * @param {Number} page 页码
 * @returns {Promise} 排行榜数据
 */
export const getDadajuanRank = async (page = 1) => {
    return await RequestManager.get('/getRankList', {
        type: 'dadajuan',
        page
    });
};