#pragma once

#include <Core/Common/CoreTypes.h>
#include <Core/Container/Vector.h>

namespace Juliet
{
    class NetworkPacket
    {
      public:
        NetworkPacket();
        NetworkPacket(Arena& arena);
        virtual ~NetworkPacket();
        NetworkPacket(NetworkPacket&);
        NetworkPacket& operator=(const NetworkPacket&);
        NetworkPacket(NetworkPacket&&) noexcept;
        NetworkPacket& operator=(NetworkPacket&&) noexcept;

        void Create(Arena& arena);

        [[nodiscard]] ByteBuffer GetRawData();

        // Pack
        NetworkPacket& operator<<(uint32 value);
        NetworkPacket& operator<<(char* data);

      protected:
        void Append(ByteBuffer buffer);

        friend class TcpSocket;

      private:
        VectorArena<Byte, 4096> Data;
        size_t                  PartialSendIndex = 0;
    };
} // namespace Juliet
