import requestModule from '@/api/request.js'
const {api} = requestModule
import {homeConfig} from "./home/config";
import {ActivityInfo, CodeResponse} from "@/activities/1015/types";

/**
 * 获取页面配置
 * @returns
 */
export function fetchPageConfig() {
	//return api.get('/c/front/content', {type: 'act915',version: '1'})
	return Promise.resolve({
		data: homeConfig,
	})
}

/**
 * 获取抽奖配置
 * @returns
 */
export function fetchLotteryConfig (){
	return api.get('/c/front/content', {type: 'act915Lottery',version: '1'})
}

/**
 * 获取915活动首页信息
 * @returns
 */
export function fetchActivityInfo (){
	return api.post('/c/activity/use_invite_915/invitation/home') as Promise<CodeResponse<ActivityInfo>>
}

/**
 * 邀请助力
 * @returns
 */
export function invitationAssist(inviterUserId, unionId) {
	return api.post('/c/activity/use_invite_915/invitation/assist', {invitationCode: inviterUserId, wxUnionId: unionId})
}

/**
 * 获取抽奖信息
 * @returns
 */
export function fetchLotteryInfo (){
	return api.get('/c/activity/turntable_lottery_915/home')
}

/**
 * 抽奖
 * @returns
 */
export function lotteryDraw (){
	return api.post('/c/activity/turntable_lottery_915/lottery/draw')
}
