#pragma once

#include <string>

namespace CppModelBase
{
    enum class Environment
    {
        Local,
        Staging,
        Production
    };

    class EnvConfig
    {
    private:
        Environment environment;
        std::string apiHost;
        unsigned int apiPort;
        std::string authRealm;
        std::string username;
        std::string password;
        bool offline;

        static Environment ParseEnvironment(const std::string &env);
        void LoadOverrides();
        void LoadCredentials();

    public:
        EnvConfig();
        explicit EnvConfig(Environment env);

        Environment GetEnvironment() const { return environment; }
        const std::string &GetApiHost() const { return apiHost; }
        unsigned int GetApiPort() const { return apiPort; }
        const std::string &GetAuthRealm() const { return authRealm; }
        const std::string &GetUsername() const { return username; }
        const std::string &GetPassword() const { return password; }
        bool HasCredentials() const { return !username.empty() && !password.empty(); }
        bool IsOffline() const { return offline; }
    };
}
