import fetch from '@/utils/fetch'

/**
 * 【查】 - 获取所有部件状态
 */
export const getOperationApi = () =>
  fetch({ url: '/train/device/operation', method: 'get' })

/**
 * 【查】 - 分页获取所有部件状态
 * @param {object} paging
 * @returns
 */
export const getOperationPageApi = (params) =>
  fetch({ url: '/train/device/operation/paging', method: 'get', params })

/**
 * 【增】 - 新增部件状态
 * @param {object} data
 * @returns
 */
export const createOperationApi = (data) =>
  fetch({ url: '/train/device/operation', method: 'post', data })

/**
 * 【改】 - 编辑部件状态
 * @param {id} number
 * @param {object} data
 * @returns
 */
export const editorOperationApi = (id, data) =>
  fetch({ url: '/train/device/operation/' + id, method: 'patch', data })

/**
 * 【改】 - 编辑部件状态
 * @param {Array[number]} ids
 * @param {object} data
 * @returns
 */
export const deleteOperationApi = (data) =>
  fetch({ url: '/train/device/operation/all', method: 'delete', data })
