#ifndef GERMANAIRLINESVA_GACONNECTOR_PATHSEGMENT_H
#define GERMANAIRLINESVA_GACONNECTOR_PATHSEGMENT_H

#include <cstdint>
#include <cstring>
#include <vector>

#include "geodata.h"

namespace germanairlinesva_recording
{
  /*
   * UINT32 | UINT16   | UINT16      | POINT
   * -------+----------+-------------+------------
   * TIME   | ALTITUDE | GROUNDSPEED | COORDINATES
   */
  class PathSegment
  {
    private:
      std::uint32_t time = 0;
      std::uint16_t altitude = 0;
      std::uint16_t groundSpeed = 0;
      struct germanairlinesva_geodata::point coordinates;
      std::vector<std::uint8_t> file;

    public:
      PathSegment() = default;
      PathSegment(std::uint32_t time,
                  std::uint16_t altitude,
                  std::uint16_t groundSpeed,
                  struct germanairlinesva_geodata::point coordinates);

      inline std::uint8_t *getBinaryData() { return file.data(); }
      inline std::size_t getBinaryLength() { return file.size(); }

      friend inline bool operator==(const PathSegment &lhs,
                                    const PathSegment &rhs)
      {
        return lhs.altitude == rhs.altitude &&
               lhs.groundSpeed == rhs.groundSpeed &&
               lhs.coordinates.latitude == rhs.coordinates.latitude &&
               lhs.coordinates.longitude == rhs.coordinates.longitude;
      }
      friend inline bool operator!=(const PathSegment &lhs,
                                    const PathSegment &rhs)
      {
        return !(lhs == rhs);
      }
  };
} // namespace germanairlinesva_recording

#endif
