import http from '@/utils/request'

// 获取景点列表
export function getTicketCategory (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(`tickettypecategory/?pageNum=${pageNum}&pageSize=${pageSize}&${status}`)
}

export function getTicketCategoryById (id) {
  return http.get(`tickettypecategory/${id}`)
}

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

export function addTicketCategory (params) {
  return http.post(`tickettypecategory`, params)
}

export function deleteTicketCategoryById (id) {
  return http.delete(`tickettypecategory/${id}`)
}

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