import service from '@/utils/request'
import type {
  WheelPrizeItemDto,
  WheelConfigDto,
  LuckWheelResultDto,
  UserWheelRecordItemDto,
} from './types'
import type { BackendServicePageResult, PageSearchParams } from '@/utils/request/types'

// 大转盘相关接口
/**
 * 获取转盘列表
 */
export const getWheelPrizeList = () => {
  return service.request<WheelPrizeItemDto[]>({
    url: `/api/cultureWheelPrizes/getWheelPrizes`,
    method: 'POST',
    data: {},
  })
}

/**
 * 前台相关转盘配置
 */
export const getWheelConfig = () => {
  return service.request<WheelConfigDto>({
    url: `/api/cultureWheelPrizes/getWheelConfig`,
    method: 'POST',
    data: {},
  })
}

/**
 * 用户抽奖
 */
export const participateLuckyWheel = () => {
  return service.request<LuckWheelResultDto>({
    url: `/api/cultureWheelPrizes/participate`,
    method: 'POST',
    data: {},
  })
}

/**
 * 获取用户大转盘记录
 */
export const getUserWheelRecordList = (data: PageSearchParams) => {
  return service.request<BackendServicePageResult<UserWheelRecordItemDto>>({
    url: `/api/cultureWheelPrizes/listWheelRecordsByPage`,
    method: 'POST',
    data,
  })
}
