#pragma once

#include <getopt.h>

#include <map>
#include <string>

/** @brief Class - Encapsulates parsing command line options and
 *                 populating arguments
 */
class ArgumentParser
{
  public:
    ArgumentParser() = delete;
    ~ArgumentParser() = default;
    ArgumentParser(const ArgumentParser&) = delete;
    ArgumentParser& operator=(const ArgumentParser&) = delete;
    ArgumentParser(ArgumentParser&&) = default;
    ArgumentParser& operator=(ArgumentParser&&) = default;

    /** @brief Constructs Argument object
     *
     *  @param argc - the main function's argc passed as is
     *  @param argv - the main function's argv passed as is
     *  @return Object constructed
     */
    ArgumentParser(int argc, char** argv);

    /** @brief Given a option, returns its argument(optarg) */
    const std::string& operator[](const std::string& opt);

    /** @brief Displays usage */
    static void usage(char** argv);

    /** @brief Set to 'true' when an option is passed */
    static const std::string trueString;

    /** @brief Set to '' when an option is not passed */
    static const std::string emptyString;

  private:
    /** @brief Option to argument mapping */
    std::map<const std::string, std::string> arguments;

    /** @brief Array of struct options as needed by getopt_long */
    static const option options[];

    /** @brief optstring as needed by getopt_long */
    static const char* optionstr;
};
