import { cityCode } from './setting';
export const getWeather = function (callback) {
  let xmlHttpReg = null as unknown as XMLHttpRequest;
  xmlHttpReg = new XMLHttpRequest();
  if (xmlHttpReg != null) {
    xmlHttpReg.open('get', `http://www.nmc.cn/rest/weather?stationid=${cityCode}`, true);
    xmlHttpReg.responseType = 'json';
    xmlHttpReg.onload = () => {
      callback(xmlHttpReg.response.data);
    };
    xmlHttpReg.send();
  }
};
export const getWeatherIcon = (name: string) => {
  return new URL(`/src/views/lifeline/bigscreen/images/weather/${name}.png`, import.meta.url).href;
};

export const getMonitorAlarmLevelIcon = (name: string) => {
  return new URL(`/src/views/lifeline/bigscreen/images/leftPanelImg/${name}.png`, import.meta.url)
    .href;
};
export const getRightPanelIcon = (name: string) => {
  return new URL(`/src/views/lifeline/bigscreen/images/rightPanelImg/${name}.png`, import.meta.url)
    .href;
};

export const getSystemNavigationIcon = (name: string) => {
  return new URL(
    `/src/views/lifeline/bigscreen/images/systemNavigation/${name}.png`,
    import.meta.url
  ).href;
};
