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

const BASE = 'production_configuration/technology_model/technology_flow_category/'

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

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

export function getProcessCategoryAll (data) {
  return request({
    url: BASE + 'all',
    method: 'get',
    params: {
      method: 'production_configuration_technology_model_technology_flow_category_all',
      platform: 'background',
      ...data
    }
  })
}

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

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

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