#ifndef FoundationFactory_H_
#define FoundationFactory_H_
#pragma message("'foundation/FoundationFactory.h' is deprecated.")

#include "foundation/SharedPtr.h"
#include "foundation/Error.h"
#include "foundation/TnTime.h"
#include "foundation/SimpleFileSystem.h"

namespace Tn
{
    namespace Foundation
    {
        class Logger;
        class TaskManager;
        class FoundationFactoryDelegate
        {
        public:
            virtual shared_ptr<Logger> GetLoggerObj() = 0;
            virtual shared_ptr<Time>GetTimeObj() = 0;
            virtual shared_ptr<SimpleFileSystem::Directory> GetDirectoryObj(const std::string& path) = 0;
                virtual shared_ptr<TaskManager> GetTaskManagerObj() = 0;
        };

        /**
        * @brief a factory that use to create object in foundation
        * Only one Delegate can be set for the lifetime of the application
        * Getting any objects effectly sets the Delegate to default and it cannot be reset
        */
        class FoundationFactory
        {
        public:
            /**
            * Load customized factory
            *@param factory pointer to user-defined factory
            *@return if operation succeeded
            */
            static bool LoadFactoryDelegate(FoundationFactoryDelegate *factory);

            /**
            * Get object of Logger
            *@return object of Logger wrapped by shared_ptr
            */
            static shared_ptr<Logger> GetLoggerObj();

            /**
            * Get object of Timer
            *@return object of Timer wrapped by shared_ptr
            */
            static shared_ptr<Time> GetTimeObj();

            /**
            * Get object of Directory
            *@param root path based on which to create the object
            *@return object of Directory wrapped by shared_ptr
            */
            static shared_ptr<SimpleFileSystem::Directory> GetDirectoryObj(const std::string& path);

            /**
            * Get singleTon of TaskManager
            *@return single instance of TaskManager wrapped by shared_ptr
            */
            static shared_ptr<TaskManager> GetTaskManagerObj();
        };
    }; //endof namespace Foundation
};//endof Tn

#endif
