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

const BASE = 'production_configuration/factory_model/factory_line/'

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

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

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

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

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

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

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