import { request } from '@wisdom-utils/utils';
import * as constants from '@wisdom-utils/components/lib/AppLayout/helpers/constants';
const API = {
  GET_INFORMATION: '/PandaCore/GCK/Message/GetInformationInfo',
  GET_INFORMATION_THREE: '/PandaOMS/OMS/MessageConfig/GetInformationInfo',
  GET_MQTT_SITE_CODE: '/PandaOMS/OMS/HostManager/GetHostConfig',
  POST_INFORMATION_STATUS: '/PandaCore/GCK/Message/PostInformationStatus',
  POST_ADD_OPTIONS: '/CityInterface/rest/services/WisdomUnion.svc/CustomerManage/AddOption',
};

const services = {
  getInformationInfo: {
    url: () =>
      window?.globalConfig?.mqtt_mess?.MessageLevel === '3.0' ? API.GET_INFORMATION_THREE : API.GET_INFORMATION,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_HTTP,
  },
  getMqttSiteCode: {
    url: API.GET_MQTT_SITE_CODE,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_HTTP,
  },
  postInformationStatus: {
    url: API.POST_INFORMATION_STATUS,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_HTTP,
  },
  postAddOptions: {
    url: API.POST_ADD_OPTIONS,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_HTTP,
  },
};

export const postInformationStatus = param =>
  request({
    url: API.POST_INFORMATION_STATUS,
    method: constants.REQUEST_METHOD_GET,
    data: param.data,
    params: param.query,
  });

export default services;