import { Layer } from "mobility-toolbox-js/ol";
import TrafimageMapboxLayer from "../../layers/TrafimageMapboxLayer";
import MapboxStyleLayer from "../../layers/MapboxStyleLayer";
import { KilometrageLayer } from "../../layers";
import RegionenkarteLayer from "../../layers/RegionenkarteLayer";

// eslint-disable-next-line import/prefer-default-export
export const getRegionenkartePublicLayers = () => {
  const anlagenverantwortliche = new TrafimageMapboxLayer({
    name: "ch.sbb.anlagenverantwortliche",
    style: "basemap_infra_bright_ch.sbb.anlagenverantwortliche",
    visible: true,
    zIndex: -1,
    properties: {
      hideInLegend: true,
      isBaseLayer: false
    },
    mapOptions: {
      preserveDrawingBuffer: true
    }
  });
  const regionenkartePublicSegment = new Layer({
    name: "ch.sbb.regionenkarte.intern.av_segmente.public",
    visible: true,
    properties: {
      hasInfos: true,
      layerInfoComponent: "RegionenkartePublicLayerInfo"
    },
    children: [new RegionenkarteLayer({
      name: "ch.sbb.regionenkarte.lines",
      mapboxLayer: anlagenverantwortliche,
      styleLayersFilter: _ref => {
        let {
          id
        } = _ref;
        return /anlagenverantwortliche\.lines$/.test(id);
      },
      properties: {
        isQueryable: true,
        hideInLegend: true,
        useOverlay: true,
        // instead of a Popup , on click an Overlay will be displayed.
        popupComponent: "RegionenkarteSegmentPopup",
        featureInfoFilter: feature => {
          // There is some points in this data source and we don't want them.
          return feature.getGeometry().getType() === "LineString" || feature.getGeometry().getType() === "MultiLineString";
        }
      }
    }), new MapboxStyleLayer({
      name: "ch.sbb.regionenkarte.stations",
      isQueryable: false,
      mapboxLayer: anlagenverantwortliche,
      styleLayersFilter: _ref2 => {
        let {
          id
        } = _ref2;
        return /anlagenverantwortliche\.stations/.test(id);
      },
      properties: {
        hideInLegend: true
      }
    }), new MapboxStyleLayer({
      name: "ch.sbb.regionenkarte.regionintersection",
      mapboxLayer: anlagenverantwortliche,
      styleLayersFilter: _ref3 => {
        let {
          id
        } = _ref3;
        return /anlagenverantwortliche\.regionintersection/.test(id);
      },
      properties: {
        hideInLegend: true,
        popupComponent: "RegionenkarteIntersectionPopup",
        isQueryable: true
      }
    })]
  });
  const regionenkarteOverlayGroup = new Layer({
    name: "ch.sbb.infrastruktur.overlay.group",
    visible: true,
    isQueryable: false,
    properties: {
      hasInfos: true,
      description: "ch.sbb.infrastruktur.overlay.group-desc"
    },
    children: [new MapboxStyleLayer({
      name: "ch.sbb.infrastruktur.betriebspunkte",
      visible: true,
      isQueryable: false,
      mapboxLayer: anlagenverantwortliche,
      styleLayersFilter: _ref4 => {
        let {
          id
        } = _ref4;
        // We select all stations
        return /FanasStation/.test(id);
      },
      properties: {
        hasInfos: true,
        description: "ch.sbb.infrastruktur.betriebspunkte-desc"
      }
    }), new MapboxStyleLayer({
      name: "ch.sbb.infrastruktur.line_point",
      visible: true,
      isQueryable: false,
      mapboxLayer: anlagenverantwortliche,
      styleLayersFilter: _ref5 => {
        let {
          id
        } = _ref5;
        return /FanasLine|DFA/.test(id);
      },
      properties: {
        hasInfos: true,
        description: "ch.sbb.infrastruktur.line_point-desc"
      }
    })]
  });
  const kilometrageLayer = new KilometrageLayer({
    mapboxLayer: anlagenverantwortliche
  });
  return [anlagenverantwortliche, regionenkarteOverlayGroup, regionenkartePublicSegment, kilometrageLayer];
};
//# sourceMappingURL=index.js.map