import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { request } from '@/plugins/http-fetch';

/**
 * 获取服务器时间
 * @returns object
 */
export async function getServerTime() {
  // 发起请求
  const result = await request({
    url: `/api/rest/systemManagement/v1/elementType/OMC/objectType/time`,
    method: 'GET',
  });
  // 解析数据
  if (result.code === RESULT_CODE_SUCCESS && result.data) {
    return Object.assign(result, {
      data: result.data.data,
    });
  }
  return result;
}

/**
 * 获取系统暴露的配置信息
 * @returns object
 */
export function getSysConf() {
  return request({
    url: `/sys-conf`,
    method: 'GET',
    whithToken: false,
  });
}
