//
//  TnUrlCreator.h
//  TelenavNavigator
//
//  Created by Shengxiong, Xia on 9/18/12.
//  Copyright (c) 2012 Telenav, Inc. All rights reserved.
//

#ifndef TelenavNavigator_UrlCreator_h
#define TelenavNavigator_UrlCreator_h

#include "foundation/SharedPtr.h"

namespace Tn 
{
    namespace Url
    {
        class AbstractUrl;
        class AbstractUrlFactory;
        class UrlCreator
        {
        public:
          
            Tn::Foundation::shared_ptr<AbstractUrl> CreateUrl();
            
            // return default implementation which uses local network connection only
            Tn::Foundation::shared_ptr<AbstractUrlFactory> GetDefaultUrlFactory();
            
            // Inject new implementation of AbstractTnUrlFactory and it will change how TnUrl works
            // For car connect feature,  network requests could be forwarded through TnLink via phone's network connectivity
            void SetUrlFactory(Tn::Foundation::shared_ptr<AbstractUrlFactory> pTnUrlFactory);
        
            static Tn::Foundation::shared_ptr<UrlCreator> GetInstance();
            
        private:
            
            UrlCreator();
            
        private:
            
            Tn::Foundation::shared_ptr<AbstractUrlFactory> m_pUrlFactory; 
            
            Tn::Foundation::shared_ptr<AbstractUrlFactory> m_pDefaultUrlFactory;
            
            static Tn::Foundation::shared_ptr<UrlCreator> m_pInstance;
        };
    }
}

#endif
