import request from '@/utils/request';
import { DemoQuery } from './types';

/**
 * 设备告警分页列表
 * @param query id、deviceId、分页、时间范围等
 */
export const listDemo = (query?: any) => {
  return request({
    url: '/device/deviceAlarm/list',
    method: 'get',
    params: query
  });
};

/**
 * 处理告警（与后端约定：POST /device/deviceAlarm/edit?ids=1,2）
 */
export const updateDemo = (ids: string | number | Array<string | number>) => {
  const idsParam = Array.isArray(ids) ? ids.join(',') : String(ids);
  return request({
    url: '/device/deviceAlarm/edit',
    method: 'post',
    params: { ids: idsParam }
  });
};
