#ifndef CONCORDIA_CONFIG_HDR
#define CONCORDIA_CONFIG_HDR

#include <string>
#include <list>
#include <libconfig.h++>

#include "concordia/concordia_exception.hpp"

/*!
Class representing the Concordia configuration.
*/
class ConcordiaConfig {
public:
    /*!
    Constructor.
     \param configFilePath path of the configuration file (see \ref running3 for file specification).
     \throws ConcordiaException
    */
    explicit ConcordiaConfig(const std::string & configFilePath)
                                       throw(ConcordiaException);

    /*! Destructor.
    */
    virtual ~ConcordiaConfig();

    /*! Getter for word map file path.
        For more information see \ref tutorial3.
     \returns word map file path
    */
    std::string & getWordMapFilePath() {
        return _wordMapFilePath;
    }

    /*! Getter for hashed index file path.
        For more information see \ref tutorial3.
     \returns hashed index file path
    */
    std::string & getHashedIndexFilePath() {
        return _hashedIndexFilePath;
    }

    /*! Getter for markers file path.
        For more information see \ref tutorial3.
     \returns markers file path
    */
    std::string & getMarkersFilePath() {
        return _markersFilePath;
    }

    /*! Getter for html tags file path.
        For more information see \ref tutorial3.
     \returns html tags file path
    */
    std::string & getHtmlTagsFilePath() {
        return _htmlTagsFilePath;
    }

    /*! Getter for space symbols file path.
        For more information see \ref tutorial3.
     \returns space symbols file path
    */
    std::string & getSpaceSymbolsFilePath() {
        return _spaceSymbolsFilePath;
    }

    /*! Getter for stop symbols enabled parameter.
        For more information see \ref tutorial3.
     \returns true if stop words are enabled
    */
    bool & isStopWordsEnabled() {
        return _stopWordsEnabled;
    }

    /*! Getter for stop words file path.
        For more information see \ref tutorial3.
     \returns stop words file path
    */
    std::string & getStopWordsFilePath() {
        return _stopWordsFilePath;
    }

    /*! Getter for named entities file path.
        For more information see \ref tutorial3.
     \returns named entities file path
    */
    std::string & getNamedEntitiesFilePath() {
        return _namedEntitiesFilePath;
    }

    /*! Getter for stop symbols file path.
        For more information see \ref tutorial3.
     \returns stop symbols file path
    */
    std::string & getStopSymbolsFilePath() {
        return _stopSymbolsFilePath;
    }

    /*! Getter for anubis threshold. Anubis search results with
        scores below that threshold will be discarded.        
     \returns anubis threshold
    */
    double getAnubisThreshold() {
        return _anubisThreshold;
    }

private:
    libconfig::Config _config;

    std::string _wordMapFilePath;

    std::string _hashedIndexFilePath;

    std::string _markersFilePath;

    std::string _htmlTagsFilePath;

    std::string _spaceSymbolsFilePath;

    bool _stopWordsEnabled;

    std::string _stopWordsFilePath;

    std::string _namedEntitiesFilePath;

    std::string _stopSymbolsFilePath;

    double _anubisThreshold;

    std::string _readConfigParameterStr(const std::string & name)
                                     throw(ConcordiaException);

    std::string _readConfigParameterStr(const std::string & name,
                                        const std::string & defaultValue)
                                                throw(ConcordiaException);
};

#endif