import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RecordVibrationInstantVO, RecordVibrationInstantForm, RecordVibrationInstantQuery } from '@/api/ems/record/types';

/**
 * 查询振动即时数据列表
 */
export function listRecordVibrationInstant(query: RecordVibrationInstantQuery): AxiosPromise<RecordVibrationInstantVO[]> {
  return request({
    url: '/ems/record/recordVibrationInstant/list',
    method: 'get',
    params: query
  });
}

/**
 * 查询振动即时数据详细
 */
export function getRecordVibrationInstant(objId: string | number): AxiosPromise<RecordVibrationInstantVO> {
  return request({
    url: '/ems/record/recordVibrationInstant/' + objId,
    method: 'get'
  });
}

/**
 * 新增振动即时数据
 */
export function addRecordVibrationInstant(data: RecordVibrationInstantForm): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordVibrationInstant',
    method: 'post',
    data: data
  });
}

/**
 * 修改振动即时数据
 */
export function updateRecordVibrationInstant(data: RecordVibrationInstantForm): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordVibrationInstant',
    method: 'put',
    data: data
  });
}

/**
 * 删除振动即时数据
 */
export function delRecordVibrationInstant(objId: string | number | Array<string | number>): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordVibrationInstant/' + objId,
    method: 'delete'
  });
}

/**
 * 查询最新振动数据
 */
export function getLatestVibrationData(monitorId: string | number): AxiosPromise<RecordVibrationInstantVO> {
  return request({
    url: '/ems/record/recordVibrationInstant/latest/' + monitorId,
    method: 'get'
  });
}

// 查询震动实时数据（曲线）
export function vibrationInstantList(query) {
  return request({
    url: '/ems/record/recordVibrationInstant/vibrationInstantList',
    method: 'get',
    params: query
  })
}
