/**
 * @file config.js
 * @author Andreas Tholen
 * Contact: info@littwin-systechnik.de
 * @version 0.5.3
 * @description Config-File for the TALAS.Map
**/

//Versionsnummer
var mapVersion = "0.5.3";

//Visual Config
var standardSideMenu = true;
var fullSideMenu = false;

// Window Height erkennen
var windowHeight = window.innerHeight;
//console.log("windowheighet:"+windowHeight);

//Zoom
var mapZoomMin = 4;
var mapZoomMax = 17;

//Datenquelle
var offlineData = false; 
var serverURL = "http://10.10.0.13";

    var url_string = window.location;
    var url = new URL(url_string);
    var c = url.searchParams.get("m");
    //c =  10;
    console.log("idMap: "+c);
    
    var user = url.searchParams.get("u");
    if (user === null) {
        user = 487;
    }
    console.log("idUser: "+user);

// Kartedaten einlesen
var mapDataStaticUrl = serverURL+"/talas5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict?idMap="+c+"&idUser="+user;
var mapDataStatusUrl = serverURL+"/talas5/ClientData/WebserviceMap.asmx/GisStationsStatusDistrict?idMap="+c+"&idUser="+user;
var mapDataMeasures = serverURL+"/talas5/ClientData/WebserviceMap.asmx/GisStationsMeasurements?idMap="+c;
var mapDataIconUrl = serverURL+"/talas5/ClientData/WebserviceMap.asmx/GetIconsStatic";
var mapDataSystemUrl = serverURL+"/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap="+c+"&idUser="+user;
const mapStaticOfflineURL = "offlineTestData/idMap"+c+"GisStationenStatic.json";
const mapStatusOfflineURL = "offlineTestData/idMap"+c+"GisStationenStatus.json";
const mapSystemOfflineURL = "offlineTestData/idMap"+c+"GisSystemStatic.json";
const mapIconsOfflineURL = "offlineTestData/icons.json";
const mapMeasuresOfflineURL = "offlineTestData/idMap"+c+"GisSystemMeasures.json";

if (offlineData) {
    console.log("%cSYSTEM| Offline Daten aktiviert!", 'color: blue');
    mapDataStaticUrl = mapStaticOfflineURL;
    mapDataSystemUrl = mapSystemOfflineURL;
    mapDataStatusUrl = mapStatusOfflineURL;
    mapDataIconUrl = mapIconsOfflineURL;
    mapDataMeasures = mapMeasuresOfflineURL;
    console.log("%cSYSTEM| Static URL: %c"+mapDataStaticUrl, 'color: blue', 'color: green');
    console.log("%cSYSTEM| Status URL: %c"+mapDataStatusUrl, 'color: blue', 'color: green');
}

// Update Zeit
var updateIntervall = 5000; // in Millisekunden

// example -> L.marker([51.5, -0.09], {icon: greenIcon}).addTo(map);
console.log("%cSYSTEM| Kartenfunktionen geladen", 'color: blue');
console.log("%cSYSTEM| Die aktuelle Fenstergröße Breite: " + window.innerWidth+"px  Höhe: "+window.innerHeight + "px", 'color: blue');
console.log("%cMAP| Marker-Icons preload abgeschlossen", 'color: green');
console.log("%cMAP| Updateintervall: "+updateIntervall+" ms", 'color: green');