#pragma once

#include <chrono>
#include <cstdint>
#include <vector>


namespace drp::packet::audio {


/**
 * Represent the content of an audio packet.
 * Contains a chunk of audio and its metadata to play it.
 */
class AudioPacketData {
public:
    [[nodiscard]] std::vector<std::uint8_t> serialize() const;
    static AudioPacketData deserialize(std::vector<std::uint8_t>& data);

    // scheduling
    // TODO(Faraphel): use a more "fixed" size format ?
    std::chrono::time_point<std::chrono::high_resolution_clock> timePlay;
    // audio settings
    std::uint8_t channels {};
    std::uint32_t sampleFormat {};
    std::uint32_t sampleRate {};
    // content
    std::vector<std::uint8_t> content {};
};


}
