/*
 *  TnProtoBufTrafficData.h
 *
 *  Created by Thant on July 15, 2013.
 *  Copyright 2013 TeleNav. All rights reserved.
 *
 *  http://spaces.telenav.com:8080/display/eng/VectorData+Proxy+Refactor+Proposal
 */

#ifndef TN_PROTOBUF_TRAFFIC_DATA_H
#define TN_PROTOBUF_TRAFFIC_DATA_H

#include <foundation/SharedPtr.h>
#include <foundation/WeakPtr.h>

#include <foundation/TnTypes.h>

#include <RenderEngine/TnMapTrafficData.h>
#include <GenericProxy/ITnTrafficProtoBufData.h>

class TnProtoBufToTrafficData : public ITnTrafficProtoBufData
{
public:

    virtual void SetTrafficData(ProtoBufPtr const &);
    virtual void SetRequestResult(eTnMapRequestResult);

    virtual TnMapTileId const & GetTileId() const;

    TnProtoBufToTrafficData(TnMapTrafficData::ptr const &);

private:

    static void Decode(ProtoBufPtr const & from,
                       TnMapTrafficData::ptr const & to);

    TnMapTrafficData::ptr m_data;
    ProtoBufPtr m_protoBuf;
    TnMapTileId m_tileId;

    static void DecodeIncident(TnMapTrafficData::ptr const & annotationData,
                               double incidentLat,
                               double incidentLon,
                               std::string const & incidentType,
                               int32_t severity,
                               int32_t laneClosed,
                               std::string const & message,
                               std::string const & crossStreet1,
                               std::string const & crossStreet2);
    
    static const char* SeverityToStyle(int32_t severity);

};


#endif // TN_PROTOBUF_TRAFFIC_DATA_H
