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

const BASE = 'production_configuration/technology_model/technology_flow_workingsubclass/'

function apiParams (method, data = {}) {
  return {
    method: `production_master_data_process_model_process_step_${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 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: {
      method: 'production_master_data_process_model_process_step_setting_submit',
      platform: 'background',
      ...data
    }
  })
}
