import TrafimageMapboxLayer from "../../layers/TrafimageMapboxLayer";
import MapboxStyleLayer from "../../layers/MapboxStyleLayer";
import { FORCE_EXPORT_PROPERTY, MapsEnergieFilter, MapsEnergieFilterValues } from "../../utils/constants";

// eslint-disable-next-line import/prefer-default-export
export const getEnergieLayers = () => {
  const energieDataLayer = new TrafimageMapboxLayer({
    name: "ch.sbb.energie.public.data",
    zIndex: -1,
    style: "basemap_infra_bright_ch.sbb.energie.public",
    properties: {
      hideInLegend: true,
      isBaseLayer: true
    },
    mapOptions: {
      preserveDrawingBuffer: true
    }
  });
  const energieLeitungenLayer = new MapboxStyleLayer({
    name: "ch.sbb.energie.public.leitungen",
    mapboxLayer: energieDataLayer,
    queryRenderedLayersFilter: _ref => {
      let {
        metadata
      } = _ref;
      return (metadata === null || metadata === void 0 ? void 0 : metadata[MapsEnergieFilter]) === MapsEnergieFilterValues.LEITUNG;
    },
    styleLayersFilter: _ref2 => {
      let {
        metadata
      } = _ref2;
      return [MapsEnergieFilterValues.LEITUNG, MapsEnergieFilterValues.LEITUNG_LABEL, MapsEnergieFilterValues.LEITUNG_LABEL_LC].includes(metadata === null || metadata === void 0 ? void 0 : metadata[MapsEnergieFilter]);
    },
    properties: {
      isQueryable: true,
      hasInfos: true,
      layerInfoComponent: "EnergieLayerInfo",
      popupComponent: "EnergiePopup",
      useOverlay: true,
      [FORCE_EXPORT_PROPERTY]: true
    }
  });
  const energieUnterwerkeLayer = new MapboxStyleLayer({
    name: "ch.sbb.energie.public.unterwerke",
    mapboxLayer: energieDataLayer,
    queryRenderedLayersFilter: _ref3 => {
      let {
        metadata
      } = _ref3;
      return (metadata === null || metadata === void 0 ? void 0 : metadata[MapsEnergieFilter]) === MapsEnergieFilterValues.ANLAGEN_UW_ICON;
    },
    styleLayersFilter: _ref4 => {
      let {
        metadata
      } = _ref4;
      return [MapsEnergieFilterValues.ANLAGEN_UW_ICON, MapsEnergieFilterValues.ANLAGEN_UW_LABEL].includes(metadata === null || metadata === void 0 ? void 0 : metadata[MapsEnergieFilter]);
    },
    properties: {
      isQueryable: true,
      hasInfos: true,
      layerInfoComponent: "EnergieLayerInfo",
      popupComponent: "EnergiePopup",
      useOverlay: true,
      [FORCE_EXPORT_PROPERTY]: true
    }
  });
  return [energieDataLayer, energieLeitungenLayer, energieUnterwerkeLayer];
};
//# sourceMappingURL=index.js.map