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

const BASE = 'production_configuration/technology_model/technology_flow_workingsubclass/'

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

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

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

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

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

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

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

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