// Feste Liste der Ausflugsziel-Kategorien (siehe anforderung.md). // Jede Kategorie hat eine stabile id (slug), ein Label, eine Farbe (Hex) // für Marker/Labels und ein Emoji-Icon als Glyph. (function () { const CATEGORIES = [ { id: 'naturpark', label: 'Naturpark', color: '#2e7d32', icon: '🌳' }, { id: 'wald-wanderweg', label: 'Wald/Wanderweg', color: '#1b5e20', icon: '🌲' }, { id: 'see-badestelle', label: 'See/Badestelle', color: '#0288d1', icon: '🏖️' }, { id: 'erlebnispark', label: 'Erlebnispark', color: '#f57c00', icon: '🎢' }, { id: 'freizeitpark', label: 'Freizeitpark', color: '#e64a19', icon: '🎡' }, { id: 'tierpark-zoo', label: 'Tierpark/Zoo', color: '#ff8f00', icon: '🦁' }, { id: 'spielplatz', label: 'Spielplatz', color: '#d81b60', icon: '🛝' }, { id: 'museum-kinder', label: 'Museum für Kinder', color: '#7b1fa2', icon: '🏛️' }, { id: 'indoor-spielplatz', label: 'Indoor-Spielplatz', color: '#5e35b1', icon: '🧸' }, { id: 'bauernhof', label: 'Bauernhof', color: '#6d4c41', icon: '🐄' }, { id: 'kletterpark', label: 'Kletterpark', color: '#00897b', icon: '🧗' }, { id: 'aussichtspunkt', label: 'Aussichtspunkt', color: '#455a64', icon: '🔭' }, { id: 'cafe-restaurant', label: 'Familienfreundliches Café/Restaurant', color: '#c62828', icon: '☕' }, { id: 'sonstige-aktivitaet', label: 'Sonstige kinderfreundliche Aktivität', color: '#00acc1', icon: '🎈' }, { id: 'sonstige', label: 'Sonstige', color: '#616161', icon: '📍' }, ]; const CATEGORY_MAP = new Map(CATEGORIES.map((c) => [c.id, c])); const CATEGORY_LABEL_MAP = new Map( CATEGORIES.map((c) => [c.label.toLowerCase(), c]) ); function getCategoryById(id) { return CATEGORY_MAP.get(id) ?? CATEGORY_MAP.get('sonstige'); } /** * Findet eine Kategorie anhand ihres Labels (z.B. aus KI-Import-JSON). * Fällt auf "Sonstige" zurück, falls kein Treffer gefunden wird. */ function getCategoryByLabel(label) { if (typeof label !== 'string') { return CATEGORY_MAP.get('sonstige'); } return CATEGORY_LABEL_MAP.get(label.toLowerCase()) ?? CATEGORY_MAP.get('sonstige'); } EventMap.config.CATEGORIES = CATEGORIES; EventMap.config.getCategoryById = getCategoryById; EventMap.config.getCategoryByLabel = getCategoryByLabel; })();