#ifndef CORE_HOST_H
#define CORE_HOST_H

#include <cstdint>

#include "core/node.h"
#include "core/types.h"
#include "network/packet.h"

namespace dofs {

class NetworkNic;

class Host : public Node {
public:
        Host(Simulator *const sim, NodeId id) noexcept;
        virtual ~Host() = default;

        // Access to the attached NIC (may be null if detached)
        NetworkNic *nic() const noexcept {
                return _nic;
        }

        // NIC lifecycle hooks (called by the NIC)
        void attach_nic(NetworkNic* nic) noexcept;
        void detach_nic(NetworkNic* nic) noexcept;

        // Data-plane completion: a whole flow has arrived.
        virtual void recv_flow(NodeId src,
                               FlowId flow,
                               FlowPriority priority,
                               Bytes flow_size) = 0;

        // Control/telemetry interrupt: ACK/NACK/TRIM_BACK, etc.
        virtual void recv_frame(const Packet& frame) = 0;

        virtual void recv_mgmt_msg(std::unique_ptr<struct MgmtMsg> msg) = 0;

        Host(const Host &) = delete;
        Host &operator=(const Host &) = delete;

private:
        NetworkNic *_nic{nullptr};
};

} // namespace dofs

#endif // CORE_HOST_H
