/******************************************************************************
*	File		-	args.h
*	Author		-	Joey Pollack
*	Date		-	2021/09/01 (y/m/d)
*	Mod Date	-	2021/09/01 (y/m/d)
*	Description	-	Processes command line arguments.
******************************************************************************/

#ifndef ARGS_H_
#define ARGS_H_

#include <string>
#include <vector>
#include <map>

namespace lunarium
{
    class Args
    {
    public:

        struct SwitchDesc
        {
            std::string symbol;
            bool expect_value;
        };

    public:
        Args(int argc, char** argv, char switch_char, std::vector<SwitchDesc>& switches);

        const std::vector<std::string>& GetPositionalArgs() const;
        const std::map<std::string, std::string>& GetSwitchArgs() const;

        int GetNumPositionalArgs() const;
        const std::string& GetArgAtPosition(int pos) const;

        bool ContainsSwitch(std::string) const;
        const std::string& GetSwitchValue(std::string) const;

        const std::vector<std::string>& GetRawArgs() const;

    private:
        std::vector<std::string> mPositionalArgs;
        std::map<std::string, std::string> mSwitchArgs;

        std::map<std::string, bool> mSwitchHasValue;

        // Raw args
        char mSwitchChar;
        int mNumArgs;
        std::vector<std::string> mArgs;

    private: // Helpers
        void Process();

    };
}

#endif  // ARGS_H_