#pragma once
// config.h — Global program configuration (config.ini next to binary)
//
// Stores internal program state: active theme, recent project directories,
// and other preferences. This file is managed by the program, not the user.
// Per-project settings belong in .editorconfig.

#include "base/base_inc.h"

////////////////////////////////
// Constants

#define CONFIG_MAX_RECENT_DIRS  10
#define CONFIG_PATH_MAX         1024

////////////////////////////////
// Config state

typedef struct Config {
    char theme[64];                                    // active theme name
    char recent_dirs[CONFIG_MAX_RECENT_DIRS][CONFIG_PATH_MAX]; // most recent first
    S32  recent_dir_count;
    B32  show_line_numbers;
    B32  syntax_enabled;
    B32  block_cursor;
    B32  cursor_smear;
    B32  smooth_scroll;
    F32  ui_scale;
    F32  editor_font_size;
    char editor_font[64];          // "FiraCode", "JetBrains Mono", "Cascadia Mono"
    char ui_font[64];              // "Inter", "FiraCode", etc.
    S32  window_width;
    S32  window_height;
    char active_project[CONFIG_PATH_MAX];
} Config;

// Global config instance
extern Config g_config;

// Resolve the path to config.ini (next to the running binary).
static void config_get_path(char *out, S32 out_size);

// Load config from disk. Populates g_config. If the file doesn't exist,
// writes a default one and returns defaults.
static void config_load(void);

// Save current g_config state to disk.
static void config_save(void);

// Push a directory to the front of the recent list (deduplicates).
static void config_push_recent_dir(const char *dir);
