import request from '@/utils/request'

export function getRaffleList(query) {
  return request({
    url: 'backendApi/raffle/list',
    method: 'get',
    params: query,
  })
}

export function getRaffleDetail(id) {
  return request({
    url: 'backendApi/raffle/info',
    method: 'get',
    params: { id },
  })
}

export function updateRaffleStatus(id, status) {
  return request({
    url: 'backendApi/raffle/change',
    method: 'get',
    params: { id, status },
  })
}

export function saveRaffle(data) {
  return request({
    url: 'backendApi/raffle/save',
    method: 'post',
    data: data,
  })
}

export function getRaffleRecords(query) {
  return request({
    url: 'backendApi/raffle/detail',
    method: 'get',
    params: query,
  })
}

export function dealRaffle(id) {
  return request({
    url: 'backendApi/raffle/deal',
    method: 'get',
    params: { id },
  })
}

// 抽奖类型列表
export function getRaffleTypeList(query) {
  return request({
    url: 'backendApi/raffleType/list',
    method: 'get',
    params: query,
  })
}

// 抽奖类型详情
export function getRaffleTypeInfo(id) {
  return request({
    url: `backendApi/raffleType/info/${id}`,
    method: 'get',
  })
}

// 保存抽奖类型
export function saveRaffleType(data) {
  return request({
    url: 'backendApi/raffleType/save',
    method: 'post',
    data: data,
  })
}

// 更新抽奖类型状态
export function updateRaffleTypeStatus(typeId, status) {
  return request({
    url: 'backendApi/raffleType/updateStatus',
    method: 'post',
    data: { typeId, status },
  })
}
