#pragma once

#include <blitz/protocol/Packets.h>
#include <godot_cpp/classes/node.hpp>
#include <blitz/protocol/PacketDispatcher.h>

namespace blitz {
class NetworkInterface : public godot::Node, public protocol::PacketDispatcher {
	GDCLASS(NetworkInterface, godot::Node)
  protected:
	static void _bind_methods();

  public:
	NetworkInterface();
	~NetworkInterface();

	void BroadcastPacket(const protocol::Packet& a_Packet);
	void SendPacket(PeerID a_Peer, const protocol::Packet& a_Packet);

	void _ready() override;
  
  private:
	void RecievePacketDataReliable(godot::PackedByteArray a_PacketData);
};

}  // namespace blitz