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

const BASE = 'production_configuration/technology_model/calculation_script/'

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

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

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

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

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

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