import http from '@/utils/request'

// 获取景点列表
export function getTicketProduct (params) {
  // eslint-disable-next-line prefer-const
  let { pageNum = 1, pageSize = 10, status = ['inactive', 'active'] } = params
  status = status.map(val => {
    return `status=${val}`
  }).join('&')
  return http.get(`ticketproduct/?pageNum=${pageNum}&pageSize=${pageSize}&${status}`)
}

export function getTicketProductById (id) {
  return http.get(`ticketproduct/${id}`)
}

export function updateTicketProductById (id, params) {
  return http.put(`ticketproduct/${id}`, params)
}

export function addTicketProduct (params) {
  return http.post(`ticketproduct`, params)
}

export function deleteTicketProductById (id) {
  return http.delete(`ticketproduct/${id}`)
}

export function activeTicketProductById (id, val) {
  return http.post(`ticketproduct/${id}/active`, { active: val })
}
