import { request } from '@/api/_service'

const BASE = 'production_configuration/device_model/device_category/'

function apiParams (method, data = {}) {
  return {
    method: `production_configuration_device_model_device_category_${method}`,
    platform: 'background',
    ...data
  }
}

export function getEquipmentCategoryList (data) {
  return request({
    url: BASE + 'list',
    method: 'get',
    params: apiParams('list', data)
  })
}

export function getEquipmentCategoryALL (data) {
  return request({
    url: BASE + 'all',
    method: 'get',
    params: apiParams('all', data)
  })
}

export function createEquipmentCategory (data) {
  return request({
    url: BASE + 'create',
    method: 'post',
    data: apiParams('create', data)
  })
}

export function editEquipmentCategory (data) {
  return request({
    url: BASE + 'edit',
    method: 'put',
    data: apiParams('edit', data)
  })
}

export function deleteEquipmentCategory (data) {
  return request({
    url: BASE + 'delete',
    method: 'delete',
    data: apiParams('delete', data)
  })
}
