import {get, post} from "@/util/request/index.js";
import {Page} from "@/common/consts/CommonConst";

export const getDeviceList = async ({page = Page.page, size = Page.size, ...params}) => {
  return await post('/device/getDeviceList', {
    page,
    size,
    ...params
  });
}


export const getDeviceDetail = async (id) => {
  return await get(`/device/getDeviceDetail/${id}`)
}

export const getDeviceMeta = async (id) => {
  return await get(`/device/getMetadataInfo/${id}`);
}
export const forbidDevice = async (ids = []) => {
  return await post('/device/forbidDevice', ids);
}
export const startDevice = async (ids = []) => {
  return await post('/device/startDevice', ids);
}

export const scrapDevice = async (data) => {
  return await post('/device/insertScrapDevice', data);
}

export const getDeviceService = async (data) => {
  return await get('/metadataService/getList', data);
}

export const deviceServiceApply = (deviceId, identifer, params) => {
  return post(`/online/device/service/request/${deviceId}/${identifer}`,
    params);
}

export const getAlarmLog = ({page = Page.page, size = Page.size, ...params}) => {
  return post(`/alarm/getAlarmLog`, {
    page,
    size,
    ...params
  });
}

export const getAlarmLogDetail = ({page = Page.page, size = Page.size, ...params}) => {
  return post(`/alarm/findAlarmLogById`, {
    page,
    size,
    ...params
  });
}


