using C4IT.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FasdCockpitCommunication
{
    public class cFasdCockpitMachineConfiguration
    {
        public const string constRegPathConfig = @"Software\Consulting4IT GmbH\First Aid Service Desk\Cockpit";

        [RegConfig]
        public string ServerUrl = "";

        public static cFasdCockpitMachineConfiguration Instance;

        static cFasdCockpitMachineConfiguration()

        {
            Instance = new cFasdCockpitMachineConfiguration();
            Instance.Load();
        }

        public void Load()
        {
            cConfigRegistryHelper.Load(constRegPathConfig, this, false);
            if (ServerUrl.ToLowerInvariant().EndsWith("/api"))
                ServerUrl = ServerUrl.Remove(ServerUrl.Length - 3, 3);
            else if (!ServerUrl.EndsWith("/"))
                ServerUrl += "/";
        }

    }
}
