#pragma once

#include <unordered_map>
#include <mutex>
#include <chrono>
#include <vector>
#include "logger.hpp"

class BroadcastAckManager
{
public:
    void addPending(uint16_t seq);
    void receiveAck(uint16_t seq);
    std::vector<uint16_t> checkTimeouts(std::chrono::seconds timeout = std::chrono::seconds(10));

private:
    std::mutex mutex_;
    std::unordered_map<uint16_t, std::chrono::steady_clock::time_point> pendingAcks_;
};

// 声明全局对象（供其他地方使用）
extern BroadcastAckManager broadcastAckMgr;
