#pragma once

#include <SDL3/SDL.h>  // Para SDL_ScaleMode

#include <array>

#include "color.hpp"
#include "ui/notifier.hpp"  // Para Notifier::Position
#include "version.h"        // Para Version::APP_NAME

// --- Namespace GameDefaults: configuración centralizada con valores por defecto del juego ---
namespace GameDefaults {

// --- GAME ---
namespace Game {
constexpr float WIDTH = 320.0F;
constexpr float HEIGHT = 256.0F;
constexpr int NAME_ENTRY_IDLE_TIME = 10;
constexpr int NAME_ENTRY_TOTAL_TIME = 60;
constexpr bool HIT_STOP = false;
constexpr int HIT_STOP_MS = 500;
constexpr const char* ITEM_TEXT_OUTLINE_COLOR = "FFFFFF00";  // 255, 255, 255, 0

// Play area por defecto
constexpr float PLAY_AREA_X = 0.0F;
constexpr float PLAY_AREA_Y = 0.0F;
constexpr float PLAY_AREA_W = 320.0F;
constexpr float PLAY_AREA_H = 216.0F;
}  // namespace Game

// --- FADE ---
namespace Fade {
constexpr const char* COLOR = "1F2B30";
constexpr float NUM_SQUARES_WIDTH = 160.0F;
constexpr float NUM_SQUARES_HEIGHT = 128.0F;
constexpr int RANDOM_SQUARES_DURATION_MS = 1;
constexpr int POST_DURATION_MS = 80;
constexpr float VENETIAN_SIZE = 12.0F;
}  // namespace Fade

// --- SCOREBOARD ---
namespace Scoreboard {
constexpr float RECT_X = 0.0F;
constexpr float RECT_Y = 216.0F;
constexpr float RECT_W = 320.0F;
constexpr float RECT_H = 40.0F;
constexpr bool SEPARATOR_AUTOCOLOR = true;
constexpr const char* SEPARATOR_COLOR = "0D1A2B";
constexpr const char* EASY_COLOR = "4B692F";
constexpr const char* NORMAL_COLOR = "2E3F47";
constexpr const char* HARD_COLOR = "76428A";
constexpr bool TEXT_AUTOCOLOR = true;
constexpr const char* TEXT_COLOR1 = "FFFFFF";
constexpr const char* TEXT_COLOR2 = "FFFFFF";
constexpr int SKIP_COUNTDOWN_VALUE = 8;
}  // namespace Scoreboard

// --- TITLE ---
namespace Title {
constexpr int PRESS_START_POSITION = 180;
constexpr float DURATION_S = 14.0F;
constexpr int ARCADE_EDITION_POSITION = 123;
constexpr int TITLE_C_C_POSITION = 80;
constexpr const char* BG_COLOR = "41526F";
}  // namespace Title

// --- BACKGROUND ---
namespace Background {
constexpr const char* ATTENUATE_COLOR = "FFFFFF00";
}

// --- BALLOONS ---
namespace Balloon {
// Configuración de física para cada nivel de globo
struct BalloonSettings {
        float vel;
        float grav;
        constexpr BalloonSettings(float v, float g)
            : vel(v),
              grav(g) {}
};

// Valores para deltaTime en segundos: vel en pixels/s, grav en pixels/s² (aceleración)
constexpr std::array<BalloonSettings, 4> SETTINGS = {{
    BalloonSettings(165.0F, 320.0F),  // Globo 0: vel=165 pixels/s, grav=320 pixels/s²
    BalloonSettings(222.0F, 360.0F),  // Globo 1: vel=222 pixels/s, grav=360 pixels/s²
    BalloonSettings(282.0F, 360.0F),  // Globo 2: vel=282 pixels/s, grav=360 pixels/s²
    BalloonSettings(327.0F, 360.0F)   // Globo 3: vel=327 pixels/s, grav=360 pixels/s²
}};

constexpr std::array<const char*, 4> COLORS = {
    "blue",
    "orange",
    "red",
    "green"};

constexpr bool BOUNCING_SOUND = false;
}  // namespace Balloon

// --- NOTIFICATION ---
namespace Notification {
constexpr Notifier::Position POS_V = Notifier::Position::TOP;
constexpr Notifier::Position POS_H = Notifier::Position::LEFT;
constexpr bool SOUND = false;
constexpr const char* COLOR = "303030";
}  // namespace Notification

// --- SERVICE MENU ---
namespace ServiceMenu {
constexpr const char* TITLE_COLOR = "99FF62";
constexpr const char* TEXT_COLOR = "FFFFFF";
constexpr const char* SELECTED_COLOR = "FFDC44";
constexpr const char* BG_COLOR = "000F00F5";
constexpr bool DROP_SHADOW = false;

// WindowMessage defaults
namespace WindowMessage {
constexpr const char* BG_COLOR = "141E32F0";      // Color(20, 30, 50, 240)
constexpr const char* BORDER_COLOR = "6496C8FF";  // Color(100, 150, 200, 255)
constexpr const char* TITLE_COLOR = "6496C8FF";   // Color(100, 150, 200, 255)
constexpr const char* TEXT_COLOR = "DCDCDCFF";    // Color(220, 220, 220, 255)
constexpr float PADDING = 15.0F;
constexpr float LINE_SPACING = 5.0F;
constexpr float TITLE_SEPARATOR_SPACING = 10.0F;  // Cambiado a float
constexpr float MIN_WIDTH = 250.0F;
constexpr float MIN_HEIGHT = 32.0F;       // Cambiado a float
constexpr float MAX_WIDTH_RATIO = 0.8F;   // Nuevo
constexpr float MAX_HEIGHT_RATIO = 0.8F;  // Nuevo
constexpr float TEXT_SAFETY_MARGIN = 15.0F;
constexpr float ANIMATION_DURATION = 0.3F;
}  // namespace WindowMessage
}  // namespace ServiceMenu

// --- INTRO ---
namespace Intro {
constexpr const char* BG_COLOR = "4664BD";
constexpr const char* CARD_COLOR = "CBDBFC";
constexpr const char* SHADOW_COLOR = "00000080";
constexpr int TEXT_DISTANCE_FROM_BOTTOM = 48;
}  // namespace Intro

// --- DEBUG ---
namespace Debug {
constexpr const char* COLOR = "00FFFF";
}

// --- RESOURCE ---
namespace Resource {
constexpr const char* COLOR = "FFFFFF";
}

// --- TABE ---
namespace Tabe {
constexpr float MIN_SPAWN_TIME = 2.0F;
constexpr float MAX_SPAWN_TIME = 3.0F;
}  // namespace Tabe

// --- PLAYER ---
namespace Player {
namespace DefaultShirt {
// Player 0 (Jugador 1)
constexpr const char* PLAYER0_DARKEST = "028ECFFF";  // 2, 142, 207, 255
constexpr const char* PLAYER0_DARK = "0297DBFF";     // 2, 151, 219, 255
constexpr const char* PLAYER0_BASE = "029FE8FF";     // 2, 159, 232, 255
constexpr const char* PLAYER0_LIGHT = "03A9F4FF";    // 3, 169, 244, 255

// Player 1 (Jugador 2)
constexpr const char* PLAYER1_DARKEST = "8E8E8EFF";  // 142, 142, 142, 255
constexpr const char* PLAYER1_DARK = "AEADADFF";     // 174, 173, 173, 255
constexpr const char* PLAYER1_BASE = "E4E4E4FF";     // 228, 228, 228, 255
constexpr const char* PLAYER1_LIGHT = "F7F1F1FF";    // 247, 241, 241, 255
}  // namespace DefaultShirt

namespace OneCoffeeShirt {
// Player 0 (Jugador 1)
constexpr const char* PLAYER0_DARKEST = "3D9C70FF";  // 61, 156, 112, 255
constexpr const char* PLAYER0_DARK = "4FA370FF";     // 79, 163, 112, 255
constexpr const char* PLAYER0_BASE = "5DDE70FF";     // 93, 222, 112, 255
constexpr const char* PLAYER0_LIGHT = "7DF25CFF";    // 125, 242, 92, 255

// Player 1 (Jugador 2)
constexpr const char* PLAYER1_DARKEST = "2E8B57FF";  // 46, 139, 87, 255
constexpr const char* PLAYER1_DARK = "3CB371FF";     // 60, 179, 113, 255
constexpr const char* PLAYER1_BASE = "48D181FF";     // 72, 209, 129, 255
constexpr const char* PLAYER1_LIGHT = "55EF8DFF";    // 85, 239, 141, 255
}  // namespace OneCoffeeShirt

namespace TwoCoffeeShirt {
// Player 0 (Jugador 1)
constexpr const char* PLAYER0_DARKEST = "D6A41AFF";  // 214, 164, 26, 255
constexpr const char* PLAYER0_DARK = "E3AE1BFF";     // 227, 174, 27, 255
constexpr const char* PLAYER0_BASE = "EFB71DFF";     // 239, 183, 29, 255
constexpr const char* PLAYER0_LIGHT = "FCC11EFF";    // 252, 193, 30, 255

// Player 1 (Jugador 2)
constexpr const char* PLAYER1_DARKEST = "E08500FF";  // 224, 133, 0, 255
constexpr const char* PLAYER1_DARK = "FA7D00FF";     // 250, 125, 0, 255
constexpr const char* PLAYER1_BASE = "FAA200FF";     // 250, 162, 0, 255
constexpr const char* PLAYER1_LIGHT = "FA8500FF";    // 250, 133, 0, 255
}  // namespace TwoCoffeeShirt

namespace OutlineColor {
// Player 0 (Jugador 1)
constexpr const char* PLAYER0 = "66323FFF";

// Player 1 (Jugador 2)
constexpr const char* PLAYER1 = "422028FF";
}  // namespace OutlineColor
}  // namespace Player

// --- OPTIONS ---
namespace Options {
// Window
constexpr const char* WINDOW_CAPTION = Version::APP_NAME;
constexpr int WINDOW_ZOOM = 2;
constexpr int WINDOW_MAX_ZOOM = 2;

// Video
constexpr SDL_ScaleMode VIDEO_SCALE_MODE = SDL_ScaleMode::SDL_SCALEMODE_NEAREST;
constexpr bool VIDEO_FULLSCREEN = false;
constexpr bool VIDEO_VSYNC = true;
constexpr bool VIDEO_INTEGER_SCALE = true;
constexpr bool VIDEO_SHADERS = false;

// Music
constexpr bool MUSIC_ENABLED = true;
constexpr int MUSIC_VOLUME = 100;

// Sound
constexpr bool SOUND_ENABLED = true;
constexpr int SOUND_VOLUME = 100;

// Audio
constexpr bool AUDIO_ENABLED = true;
constexpr int AUDIO_VOLUME = 100;

// Settings
constexpr bool SETTINGS_AUTOFIRE = true;
constexpr bool SETTINGS_SHUTDOWN_ENABLED = false;
constexpr const char* PARAMS_FILE = "param_320x256.txt";
}  // namespace Options
}  // namespace GameDefaults