#pragma once

#include <imgui.h>

namespace ta::presentation::theme
{
    namespace palette
    {
        inline constexpr ImVec4 accent = ImVec4(0.200f, 0.780f, 0.720f, 1.0f);
        inline constexpr ImVec4 accent2 = ImVec4(0.950f, 0.580f, 0.250f, 1.0f);
        inline constexpr ImVec4 bg = ImVec4(0.035f, 0.047f, 0.063f, 0.985f);
        inline constexpr ImVec4 surface = ImVec4(0.065f, 0.082f, 0.105f, 1.0f);
        inline constexpr ImVec4 surface2 = ImVec4(0.090f, 0.115f, 0.145f, 1.0f);
        inline constexpr ImVec4 line = ImVec4(0.150f, 0.210f, 0.260f, 1.0f);
        inline constexpr ImVec4 text = ImVec4(0.900f, 0.940f, 0.960f, 1.0f);
        inline constexpr ImVec4 muted = ImVec4(0.520f, 0.620f, 0.680f, 1.0f);
        inline constexpr ImVec4 success = ImVec4(0.300f, 0.820f, 0.550f, 1.0f);
        inline constexpr ImVec4 warning = ImVec4(0.950f, 0.700f, 0.260f, 1.0f);
        inline constexpr ImVec4 danger = ImVec4(0.920f, 0.330f, 0.330f, 1.0f);
        inline constexpr ImVec4 info = ImVec4(0.350f, 0.650f, 0.950f, 1.0f);
    }

    struct UiMetrics
    {
        float scale = 1.0f;
        float spacing_xs = 3.0f;
        float spacing_sm = 6.0f;
        float spacing_md = 9.0f;
        float spacing_lg = 14.0f;
        float form_stack_width = 200.0f;
        float column_min_width = 200.0f;
        float sidebar_min_width = 142.0f;
        float sidebar_max_width = 178.0f;
        float window_min_width = 760.0f;
        float window_min_height = 520.0f;
        float window_width = 1240.0f;
        float window_height = 760.0f;
    };

    [[nodiscard]] ImVec4 with_alpha(ImVec4 color, float alpha);
    [[nodiscard]] float scaled(float value) noexcept;
    [[nodiscard]] UiMetrics ui_metrics() noexcept;
    [[nodiscard]] bool compact_for_width(float available_width, float minimum_unscaled) noexcept;

    void apply_compact_metrics();
    void apply_modern_style();
}
