import service from '@/utils/request'

// 创建通道
export const addChannel = (data) => {
  return service({
    url: '/parking/channel/create',
    method: 'post',
    data
  })
}

// 更新通道
export const editChannel = (data) => {
  return service({
    url: '/parking/channel/update',
    method: 'put',
    data
  })
}

// 根据ID获取通道
export const obtainChannelId = (id) => {
  return service({
    url: '/parking/channel/get?id=' + id,
    method: 'get'
  })
}

// 根据编码获取通道
export const obtainChannelCode = (code) => {
  return service({
    url: '/parking/channel/get-by-code?code=' + code,
    method: 'get'
  })
}

// 获取通道列表
export const obtainChannelList = (params) => {
  return service({
    url: '/parking/channel/list',
    method: 'get',
    params
  })
}

// 删除通道
export const deleteChannel = (id) => {
  return service({
    url: '/parking/channel/delete?id=' + id,
    method: 'delete'
  })
}
