import request from "@/utils/request";
const serverState = () => {
  return request({
    url: "/logs/server_state",
    method: "get",
  });
};
//获取用户操作状态通知
const userOperationNotice = () => {
  return request({
    url: "/logs/user_operation/notice",
    method: "get",
  });
};

const userRunning = () => {
  return request({
    url: `/logs/user_operation/running`,
    method: "get",
  });
};

//获取用户操作详情
const userOperation = (operation_id) => {
  return request({
    url: `/logs/user_operation/${operation_id}`,
    method: "get",
  });
};

//获取编译部署日志
const compileDeploy = (operation_id, LatestTime) => {
  let url = `/logs/compile_deploy/${operation_id}`;
  if (LatestTime) {
    url += "?LatestTime=" + LatestTime;
  }
  return request({
    url: url,
    method: "get",
  });
};

//获取推理最新的模型推理日志
const inferenceTask = (task_id, DeviceId, dt) => {
  return request({
    url: `/logs/inference/${task_id}?deviceId=${DeviceId}&startTime=${dt}&page_num=1&page_size=100`,
    method: "get",
  });
};

//获取推理最新的模型推理日志
const inferenceTaskLatest = (task_id, DeviceId) => {
  return request({
    url: `/logs/inference/${task_id}/latest?DeviceId=${DeviceId}&LogCount=50`,
    method: "get",
  });
};

export default {
  serverState,
  userOperationNotice,
  userOperation,
  compileDeploy,
  userRunning,
  inferenceTaskLatest,
  inferenceTask,
};
