/* osgEarth - Geospatial SDK for OpenSceneGraph
 * Copyright 2018 Pelican Mapping
 * MIT License
 */
#ifndef OSGEARTH_DRIVER_TILEINDEX_DRIVEROPTIONS
#define OSGEARTH_DRIVER_TILEINDEX_DRIVEROPTIONS 1

#include <osgEarth/Common>
#include <osgEarth/TileSource>
#include <osgEarth/GeoCommon>
#include <osgEarth/URI>

namespace osgEarth { namespace Drivers
{
    using namespace osgEarth;

    class TileIndexOptions : public TileSourceOptions // NO EXPORT; header only
    {      
    public: // properties

        optional<URI>& url() { return _url; }
        const optional<URI>& url() const { return _url; }

    public: // ctors

        TileIndexOptions( const TileSourceOptions& options =TileSourceOptions() ) :
            TileSourceOptions( options )            
        {
            setDriver( "tileindex" );
            fromConfig( _conf );
        }

        virtual ~TileIndexOptions() { }

    public:

        Config getConfig() const
        {
            Config conf = TileSourceOptions::getConfig();
            conf.set( "url", _url );
            return conf;
        }

        void mergeConfig( const Config& conf ) {
            TileSourceOptions::mergeConfig( conf );
            fromConfig( conf );
        }

        void fromConfig( const Config& conf ) {
            conf.get( "url", _url );
        }

        optional<URI>                    _url;        
    };

} } // namespace osgEarth::Drivers

#endif // OSGEARTH_DRIVER_TILEINDEX_DRIVEROPTIONS
