#include <blitz/protocol/PacketSender.h>

#include <blitz/godot/NetworkInterface.h>
#include <blitz/protocol/PacketSerializer.h>

namespace blitz {
namespace protocol {

///////////////////////
/* PacketBroadcaster */
///////////////////////

#define DeclarePacket(PacketName, Reliability, ...)                                                                                   \
	void PacketBroadcaster::Visit(const protocol::packets::PacketName& a_Packet) {                                                    \
		m_NetworkInterface.rpc("RecievePacketData" #Reliability, protocol::PacketSerializer::Serialize(a_Packet));                    \
	}

DeclareAllPacket()

#undef DeclarePacket





//////////////////
/* PacketSender */
//////////////////
#define DeclarePacket(PacketName, Reliability, ...)                                                                                   \
	void PacketSender::Visit(const protocol::packets::PacketName& a_Packet) {                                                         \
		m_NetworkInterface.rpc_id(m_PeerId, "RecievePacketData" #Reliability, protocol::PacketSerializer::Serialize(a_Packet));       \
	}

	DeclareAllPacket()

#undef DeclarePacket

}  // namespace protocol
}  // namespace blitz
