#pragma once

#include <string>
#include <optional>
#include <map>
#include <memory>
#include "lumacs/color.hpp"

namespace lumacs {

// Font weight
enum class FontWeight {
    Normal,
    Bold,
    Light,
};

// Font slant
enum class FontSlant {
    Normal,
    Italic,
    Oblique
};

struct FaceAttributes {
    // GUI-specific attributes (ignored in standard TUI/Ncurses)
    std::optional<std::string> family; // e.g., "Fira Code", "Arial"
    std::optional<int> height;         // 1/10 pt. e.g., 120 = 12pt

    // Universal attributes (Supported in TUI via Bold/Italic flags)
    std::optional<FontWeight> weight;  // Normal vs Bold
    std::optional<FontSlant> slant;    // Normal vs Italic
    
    std::optional<Color> foreground;
    std::optional<Color> background;
        std::optional<bool> underline;
        std::optional<bool> inverse;
        std::optional<std::string> inherit; // Name of face to inherit from
    
        // Merging logic: apply other on top of this
        void merge(const FaceAttributes& other) {
            if (other.family) family = other.family;
            if (other.height) height = other.height;
            if (other.weight) weight = other.weight;
            if (other.slant) slant = other.slant;
            if (other.foreground) foreground = other.foreground;
            if (other.background) background = other.background;
            if (other.underline) underline = other.underline;
            if (other.inverse) inverse = other.inverse;
            if (other.inherit) inherit = other.inherit;
        }
    };
class Face {
public:
    Face(std::string name) : name_(std::move(name)) {}
    
    const std::string& name() const { return name_; }
    FaceAttributes& attributes() { return attributes_; }
    const FaceAttributes& attributes() const { return attributes_; }

private:
    std::string name_;
    FaceAttributes attributes_;
};

} // namespace lumacs
