#pragma once

// In-memory pairing store - trivial port of src/pairing.js

#include <string>
#include <unordered_map>
#include <cstdint>

struct PairingEntry {
    std::string code;
    std::string name;
    uint64_t    created_at;
};

struct DeviceEntry {
    std::string name;
    std::string token;
    uint64_t    created_at;
};

class PairingStore {
public:
    void set_pairing_code(const std::string& code, const std::string& name = "JTL-POS");
    void revoke_pairing_code(const std::string& code);
    bool has_pairing_code(const std::string& code) const;

    void register_device(const std::string& token, const std::string& name = "JTL-POS");
    const std::unordered_map<std::string, DeviceEntry>& get_paired_devices() const;

private:
    std::unordered_map<std::string, PairingEntry> auth_codes_;
    std::unordered_map<std::string, DeviceEntry>  paired_devices_;
};
