import request from '@/utils/request';
import type {
  EmsActionResponse,
  EmsDetailResponse,
  EmsId,
  EmsIdParam,
  EmsListResponse,
  RecordIotenvInstantVO,
  RecordVibrationInstantQuery
} from '../types';

// 查询振动实时数据列表
export function listRecordVibrationInstant(query?: RecordVibrationInstantQuery): Promise<EmsListResponse<RecordIotenvInstantVO>> {
  return request({
    url: '/ems/record/recordVibrationInstant/list',
    method: 'get',
    params: query
  });
}

// 查询振动实时数据详细
export function getRecordVibrationInstant(objId: EmsId): Promise<EmsDetailResponse<RecordIotenvInstantVO>> {
  return request({
    url: '/ems/record/recordVibrationInstant/' + objId,
    method: 'get'
  });
}

// 新增振动实时数据
export function addRecordVibrationInstant(data: RecordIotenvInstantVO): Promise<EmsActionResponse<RecordIotenvInstantVO>> {
  return request({
    url: '/ems/record/recordVibrationInstant',
    method: 'post',
    data: data
  });
}

// 修改振动实时数据
export function updateRecordVibrationInstant(data: RecordIotenvInstantVO): Promise<EmsActionResponse<RecordIotenvInstantVO>> {
  return request({
    url: '/ems/record/recordVibrationInstant',
    method: 'put',
    data: data
  });
}

// 删除振动实时数据
export function delRecordVibrationInstant(objId: EmsIdParam): Promise<EmsActionResponse> {
  return request({
    url: '/ems/record/recordVibrationInstant/' + objId,
    method: 'delete'
  });
}

// 查询振动实时数据（曲线）
export function vibrationInstantList(query?: RecordVibrationInstantQuery): Promise<EmsListResponse<RecordIotenvInstantVO>> {
  return request({
    url: '/ems/record/recordVibrationInstant/vibrationInstantList',
    method: 'get',
    params: query
  });
}
