#pragma once
#ifndef LEXESIS_BACKENDMANAGER_H
#define LEXESIS_BACKENDMANAGER_H

#include <memory>
#include <string>
#include <vector>

#include "Lexesis/backend.h"

namespace lxs {
    /**
     * A manager for backends
     * Aggregates and allow to search for backends that can process a specific language
     */
    class BackendManager {
        public:
            /**
             * Add a backend to the list of registered backends
             *
             * @param backend The backend to register
             */
            void registerBackend(std::unique_ptr<Backend> backend);

            /**
             * Get a backend that can process the given language
             * The manager retains ownership of the returned pointer
             *
             * @param lang The language the backend should be able to process
             * @returns A pointer to a Backend if it can find one, nullptr otherwise
             */
            Backend* findBackendForLang(std::string lang);

        private:
            std::vector<std::unique_ptr<Backend> > m_backends; ///< The list of registered backends
    };
}

#endif //LEXESIS_BACKENDMANAGER_H
