#pragma once

#include <string>
#include <unordered_map>
#include <optional>

namespace lumacs {

/// @brief Manages Emacs-like registers for storing text.
/// Registers are named storage locations (typically a single character).
class RegisterManager {
public:
    RegisterManager() = default;

    /// @brief Saves text to a named register.
    /// @param register_name The character name of the register (e.g., 'a', 'B', '1').
    /// @param text The string content to save.
    void copy_to_register(char register_name, const std::string& text);

    /// @brief Retrieves text from a named register.
    /// @param register_name The character name of the register.
    /// @return The optional string content if the register exists, `std::nullopt` otherwise.
    [[nodiscard]] std::optional<std::string> get_from_register(char register_name) const;

private:
    std::unordered_map<char, std::string> registers_;
};

} // namespace lumacs
