import http from '@/utils/request'

export function getBatchList (params) {
  // eslint-disable-next-line prefer-const
  let { pageNum = 1, pageSize = 10, status = ['inactive', 'active'], type } = params
  status = status.map(val => {
    return `status=${val}`
  }).join('&')

  return http.get(`batchtype/?${(pageNum === 0 || pageNum) ? `pageNum=${pageNum}` : ''}&${(pageSize === 0 || pageSize) ? `pageSize=${pageSize}` : ''}&${status}&${type ? `type=${type}` : ''}`)
}

export function getBatchTicket (id) {
  return http.get(`/batchtype/${id}/ticket`)
}

export function setBatchTicket (id, tickets) {
  return http.post(`/batchtype/${id}/ticket`, {
    tickets
  })
}

export function getBatchTicketPrice (id) {
  return http.get(`/batchtype/${id}/ticketprice`)
}

export function setBatchTicketPrice (id, tickets) {
  return http.post(`/batchtype/${id}/ticketprice`, {
    tickets
  })
}
// 设置场次颜色
export function setBatchColor (id, color) {
  return http.post(`/batchtype/${id}/color`, {
    color
  })
}
