#pragma once

#include <cstdint>


namespace network {

    class datagramm_stream_t : public stream_t {
    private:
        enum class state_t : uint8_t {
            header = 0,
            length = 1,
            body = 2,
            crc = 3,
            
        };
    public:
        std::tuple<int, void*> next() {

        }
    };

    template<uint16_t v_max_payload_size, uint8_t v_max_number_of_sockets>
    class datagramm_t {
    public:
        constexpr static uint16_t max_payload_size = v_max_payload_size;
        constexpr static uint8_t max_number_of_sockets = v_max_number_of_sockets;

        auto open(uint16_t destination_address, uint16_t destination_port) {
            retun 0;
        }

        bool send(stream_t* stream) {
            underlying_t::stream_t underlying_stream(stream);
            m_underlying.send(undelying_stream);
        }

        void receive() {

        }

    private:
        underlying_t m_underlying;
    };
}
