import { params } from 'kit_utils';
import qs from 'qs';

const API = {
  GET_INFORMATION:
    '/CityInterface/rest/services/CountyProduct.svc/SCADAOper/GetInformationInfo',
  GET_MQTT_SITE_CODE:
    '/CityInterface/rest/services/CountyProduct.svc/SCADAOper/getMqttSitecode',
  POST_INFORMATION_STATUS:
    '/CityInterface/rest/services/CountyProduct.svc/SCADAOper/PostInformationStatus',
};
export default vm => {
  vm.getInformationInfo = (data = {}) =>
    vm.get(API.GET_INFORMATION, data).then(res => Promise.resolve(res));

  vm.getMqttSiteCode = (data = {}) =>
    vm.get(API.GET_MQTT_SITE_CODE, data).then(res => Promise.resolve(res));

  vm.postInformationStatus = (params = {}) =>{
    let paramsStr=qs.stringify(params, { arrayFormat: 'brackets' });
   return vm.post(API.POST_INFORMATION_STATUS+"?"+paramsStr).then(res => Promise.resolve(res));
  }
};
