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

const BASE = 'production_configuration/technology_model/technology_flow_process/'

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

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

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

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

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

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

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

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