import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MeasurementControlPointForm, MeasurementControlPointQuery, MeasurementControlPointVO } from './types';

export const listMeasurementControlPoint = (params?: MeasurementControlPointQuery): AxiosPromise<MeasurementControlPointVO[]> => {
  return request({
    url: '/ems/measurementControlPoint/list',
    method: 'get',
    params
  });
};

export const getMeasurementControlPoint = (id: string | number): AxiosPromise<MeasurementControlPointVO> => {
  return request({
    url: '/ems/measurementControlPoint/' + id,
    method: 'get'
  });
};

export const addMeasurementControlPoint = (data: MeasurementControlPointForm) => {
  return request({
    url: '/ems/measurementControlPoint',
    method: 'post',
    data
  });
};

export const updateMeasurementControlPoint = (data: MeasurementControlPointForm) => {
  return request({
    url: '/ems/measurementControlPoint',
    method: 'put',
    data
  });
};

export const delMeasurementControlPoint = (ids: string | number | Array<string | number>) => {
  return request({
    url: '/ems/measurementControlPoint/' + ids,
    method: 'delete'
  });
};
