#pragma once
#include <string>

struct HWIDComponents {
    std::string cpu;     // SHA-256 of CPU name
    std::string board;   // SHA-256 of motherboard serial
    std::string disk;    // SHA-256 of volume serial
    std::string mac;     // SHA-256 of MAC address
    bool valid = false;  // true if at least CPU + Board collected
};

/**
 * HWIDCollector — collects hardware identifiers and hashes each one individually.
 * Each component is SHA-256 hashed before leaving the client.
 * The server NEVER sees raw hardware IDs.
 */
class HWIDCollector
{
public:
    static HWIDCollector* Get();

    /// Collect all hardware components (cached after first call).
    const HWIDComponents& Collect();

    /// Return previously collected components (must call Collect() first).
    const HWIDComponents& GetComponents() const { return m_components; }

private:
    HWIDCollector() = default;
    ~HWIDCollector() = default;

    std::string CollectCPUId();
    std::string CollectBoardSerial();
    std::string CollectVolumeSerial();
    std::string CollectMacAddress();

    /// SHA-256 hash a string, returns hex string.
    static std::string SHA256(const std::string& input);

    HWIDComponents m_components;
    bool m_collected = false;
};
