import service from '@/utils/request'
import type { BackendLotteryConfigDto } from '../backend/activity/types'
import type { SearchLotteryRecordParams, UserLotteryRecordItemDto } from './types'
import type { BackendServicePageResult } from '@/utils/request/types'
// 每日抽奖相关接口

/**
 * 获取用户当前每日抽奖相关信息 返回null 不显示
 */
export const getUserDailyLotteryInfo = () => {
  return service.request<BackendLotteryConfigDto>({
    url: `/api/cultureLotteryPrizes/getLotteryConfigDetail`,
    method: 'POST',
  })
}

/**
 * 用户参与抽奖
 */
export const userJoinLottery = () => {
  return service.request({
    url: `/api/cultureLotteryPrizes/participate`,
    method: 'POST',
  })
}

/**
 * 获取用户抽奖记录列表
 */
export const getUserLotteryRecordList = (data: SearchLotteryRecordParams) => {
  return service.request<BackendServicePageResult<UserLotteryRecordItemDto>>({
    url: `/api/personalCenter/listLotteryPage`,
    method: 'POST',
    data,
  })
}
