#pragma once

#include "SimCore/Identifier.hpp"
#include "SimCore/Messages/Protos/RadarTrack.pb.h"
#include "SimCore/SimCore.hpp"
#include "google/protobuf/any.pb.h"
#include <SimCore/Messages/Protos/RadarTrack.pb.h>
#include <SimCore/Position.hpp>

#include <SimCore/Messages/Track.hpp>


#include <Eigen/Core>

#include <cstddef>
#include <cstdint>
#include <loguru.hpp>
#include <memory>
#include <string>

namespace SimCore {

class RadarTrack : public Track  {
    
private:
 

  /// position of the track
  Position position_;
  /// speed the track
  double speed_ = 0;
  /// course of the track
  double course_ = 0;

  /// bearing  
  double bearing_;
  ///range in meters
  double range_;
  //environment (AIR,SURFACE,SUBSURFACE,SPACE)
  SimCore::EntityKind environemnt_;



public:


  /**
   * @brief constructor for building a track  which is also the trackmessage to
   * send
   * @param WHISPER::SourceType sourcetype of the sending device
   * @param SimCore::Identifier object identifier
   *
   * @return
   */
  RadarTrack(WHISPER::SourceType src,SimCore::Identifier id);


  virtual WHISPER::Message buildMessage(SimCore::Identifier parentID) override;


  /**
   * @brief set the position of the track
   * @param Position object of the position class
   *
   */
  void setPosition(Position pos);

  /**
   * @brief set the position of the track
   * @param 3x double set the x,y,z coordinates direkt which causes that an
   * object of position class is created
   */
  void setPosition(double x, double y, double z);

  /**
   * @brief returns the position
   * @return object of position class
   *
   */
  Position getPostion();

  /// sets speed
  void setSpeed(double speed);

  /// set speed in knots
  void setSpeedinKnots(double knots);

  /// return sspeed
  double getSpeed();

  /// returns speed as knots
  double getSpeedinKnots();

  /// set course
  void setCourse(double course);

  /// returns course
  double getCourse();

  /// set course
  void setBearing(double bearing);

  /// returns course
  double getBearing();

  /// set course
  void setRange(double range);

  /// returns course
  double getRange();

  /// set course
  void setEnvironment(SimCore::EntityKind);

  /// returns course
  SimCore::EntityKind getEnvironment();

  /// set external indicator
  void setExternal(bool val);

  static RadarTrack unpack(WHISPER::Message msg);


};
} // namespace SimCore