import React from "react";
import PropTypes from "prop-types";
import { Layer } from "mobility-toolbox-js/ol";
import useTranslation from "../../utils/useTranslation";
import Link from "../../components/Link";
import OperatorLegend from "./OperatorLegend";
import OperatorShortAndLongName from "./OperatorShortAndLongName";
const propTypes = {
  properties: PropTypes.instanceOf(Layer).isRequired
};
const translations = {
  de: {
    title: "Normalspurstrecken - TVS",
    description: "Infrastrukturbetreiberinnen, die sich im Zuständigkeitsbereich der Schweizerischen Trassenvergabestelle TVS befinden.",
    dataInfo1: "Datengrundlage: BAV und SBB",
    dataInfo2: "Datenstand: Dezember 2025"
  },
  fr: {
    title: "Voies normales - SAS",
    description: "Gestionnaires d'infrastructure qui se trouvent dans le domaine de compétence du service suisse d'attribution des sillons SAS.",
    dataInfo1: "Base de données: OFT et CFF",
    dataInfo2: "État des données: Décembre 2025"
  },
  it: {
    title: "Tratte a scartamento normale - SAT",
    description: "I gestori dell'infrastruttura che rientrano nell'area di responsabilità del Servizio svizzero di assegnazione delle tracce SAT.",
    dataInfo1: "Base dati: UFT e FFS",
    dataInfo2: "Aggiornamento dei dati: Dicembre 2025"
  },
  en: {
    title: "Standard gauge - TVS",
    description: "Infrastructure managers who are within the area of responsibility of the Swiss train path allocation body TVS.",
    dataInfo1: "Data basis: FOT and SBB",
    dataInfo2: "Data status: December 2025"
  }
};
function IsbTVSLayerInfo(_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");

  // SBB , BLS, SOB
  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("p", null, /*#__PURE__*/React.createElement(Link, {
    href: "https://www.tvs.ch/"
  }, "www.tvs.ch")), /*#__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));
}
IsbTVSLayerInfo.propTypes = propTypes;
export default /*#__PURE__*/React.memo(IsbTVSLayerInfo);
//# sourceMappingURL=IsbTVSLayerInfo.js.map