import fetch from '@/utils/fetch'

/**
 * 【查】 - 获取所有号位
 */
export const getPostApi = () =>
  fetch({ url: '/train/device/position', method: 'get' })

/**
 * 【查】 - 分页获取所有号位
 * @param {object} paging
 * @returns
 */
export const getPostPageApi = (paging) =>
  fetch({ url: `/train/device/position/paging/?currentPage=${paging.currentPage}&pageSize=${paging.pageSize}`, method: 'get' })

/**
 * 【增】 - 新增号位
 * @param {object} data
 * @returns
 */
export const createPostApi = (data) =>
  fetch({ url: '/train/device/position', method: 'post', data })

/**
 * 【改】 - 编辑号位
 * @param {id} number
 * @param {object} data
 * @returns
 */
export const editorPostApi = (id, data) =>
  fetch({ url: '/train/device/position/' + id, method: 'patch', data })

/**
 * 【改】 - 编辑号位
 * @param {Array[number]} ids
 * @param {object} data
 * @returns
 */
export const deletePostApi = (data) =>
  fetch({ url: '/train/device/position/all', method: 'delete', data })
