import request from '@/utils/request'

// 查询服务分类列表
export function listCategory(query) {
  return request({
    url: '/api/service/category/list',
    method: 'get',
    params: query
  })
}

// 查询服务列表
export function listService(query) {
  return request({
    url: '/merchant/service/list',
    method: 'get',
    params: query
  })
}

// 查询服务详细
export function getService(serviceId) {
  return request({
    url: '/merchant/service/' + serviceId,
    method: 'get'
  })
}

// 新增服务
export function addService(data) {
  return request({
    url: '/merchant/service',
    method: 'post',
    data: data
  })
}

// 修改服务
export function updateService(data) {
  return request({
    url: '/merchant/service/' + data.id,
    method: 'put',
    data: data
  })
}

// 删除服务
export function delService(serviceId) {
  return request({
    url: '/merchant/service/' + serviceId,
    method: 'delete'
  })
}

// 上架/下架服务
export function updateServiceStatus(serviceId, status) {
  return request({
    url: '/merchant/service/' + serviceId + '/status',
    method: 'put',
    data: { status }
  })
}
