import React from "react";
import PropTypes from "prop-types";
import { Layer } from "mobility-toolbox-js/ol";
import useTranslation from "../../utils/useTranslation";
import OperatorLegend from "../IsbTVSLayerInfo/OperatorLegend";
import OperatorShortAndLongName from "../IsbTVSLayerInfo/OperatorShortAndLongName";
const propTypes = {
  properties: PropTypes.instanceOf(Layer).isRequired
};
const translations = {
  de: {
    title: "Normalspurstrecken - übrige",
    description: "Übrige Normalspurstrecken, die sich nicht im Zuständigkeitsbereich der Schweizerischen Trassenvergabestelle TVS befinden.",
    dataInfo1: "Datengrundlage: BAV",
    dataInfo2: "Datenstand: Dezember 2025"
  },
  fr: {
    title: "Voies normales - autres",
    description: "Autres lignes à voie normale qui ne se trouvent pas dans le domaine de compétence du service suisse d'attribution des sillons SAS.",
    dataInfo1: "Base de données: OFT",
    dataInfo2: "État des données: Décembre 2025"
  },
  it: {
    title: "Tratte a scartamento normale - altre",
    description: "Altre linee a scartamento normale che non rientrano nell'area di responsabilità del Servizio svizzero di assegnazione delle tracce SAT.",
    dataInfo1: "Base dati: UFT",
    dataInfo2: "Aggiornamento dei dati: Dicembre 2025"
  },
  en: {
    title: "Standard gauge - other",
    description: "Other standard gauge lines which are not within the area of responsibility of the Swiss train path allocation body TVS.",
    dataInfo1: "Data basis: FOT",
    dataInfo2: "Data status: December 2025"
  }
};
function IsbOtherLayerInfo(_ref) {
  let {
    properties: layer
  } = _ref;
  const {
    i18n
  } = useTranslation();
  const {
    title,
    description,
    dataInfo1,
    dataInfo2
  } = translations[i18n.language];
  const defaultColor = layer.get("defaultColor") || {};
  const colors = layer.get("colors") || "";
  const shortToLongName = layer.get("shortToLongName") || {};

  // Importamt operators
  const operators = Object.entries(shortToLongName).filter(_ref2 => {
    let [key] = _ref2;
    return !!colors[key];
  });

  // Others
  const othersOperators = Object.keys(shortToLongName).filter(key => !colors[key]);
  operators.push(["", othersOperators.join(", ")]);
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, title), /*#__PURE__*/React.createElement("p", null, description), /*#__PURE__*/React.createElement("div", null, operators.map(_ref3 => {
    let [shortName, longName] = _ref3;
    const color = colors[shortName] || defaultColor;
    return /*#__PURE__*/React.createElement(OperatorLegend, {
      key: shortName,
      color: color,
      longName: longName,
      shortName: shortName
    });
  })), /*#__PURE__*/React.createElement("br", null), othersOperators.map(shortName => {
    return /*#__PURE__*/React.createElement(OperatorShortAndLongName, {
      key: shortName,
      shortName: shortName,
      longName: shortToLongName[shortName]
    });
  }), /*#__PURE__*/React.createElement("p", null, dataInfo1, /*#__PURE__*/React.createElement("br", null), dataInfo2));
}
IsbOtherLayerInfo.propTypes = propTypes;
export default /*#__PURE__*/React.memo(IsbOtherLayerInfo);
//# sourceMappingURL=IsbOtherLayerInfo.js.map