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

const BASE = 'quality_control/xqc/sampling_plan/'

function apiParams (data = {}, method = 'xqc.sampling_plan_config.list', platform = 'api') {
  return { method, platform, ...data }
}
export function fetchSamplingPlansList (data = {}) {
  return request({
    url: BASE + 'list',
    method: 'post',
    data: apiParams(data, 'xqc.sampling_plan_config.list', 'api')
  })
}

export function createSamplingPlans (data = {}) {
  return request({
    url: BASE + 'save',
    method: 'post',
    data: apiParams(data, 'xqc.sampling_plan_config.save', 'api')
  })
}

export function editSamplingPlans (data = {}) {
  return request({
    url: BASE + 'save',
    method: 'post',
    data: apiParams(data, 'xqc.sampling_plan_config.save', 'api')
  })
}

export function deleteSamplingPlans (data = {}) {
  return request({
    url: BASE + 'delete',
    method: 'post',
    data: apiParams(data, 'xqc.sampling_plan_config.delete', 'api')
  })
}

