/*
    * messagebox.hpp
    * Message box dialog declarations
    * Copyright (c) 2026 Daniel Hammer
*/

#pragma once

#include <montauk/syscall.h>
#include <gui/gui.hpp>
#include <gui/dialogs.hpp>

struct MessageBoxLayout {
    gui::Rect text_rect;
    gui::Rect footer_rect;
    gui::Rect buttons[3];
    int button_count;
};

namespace messagebox {

constexpr int MESSAGE_MIN_W = 300;
constexpr int MESSAGE_MAX_W = 560;
constexpr int MESSAGE_MIN_H = 124;
constexpr int MESSAGE_MAX_H = 280;
constexpr int FOOTER_H = 56;
constexpr int TEXT_X = 20;
constexpr int TEXT_Y = 24;
constexpr int TEXT_BOTTOM_GAP = 24;
constexpr int BUTTON_RIGHT_PAD = 16;
constexpr int BUTTON_W = 88;
constexpr int BUTTON_H = 30;
constexpr int BUTTON_GAP = 8;
constexpr int MAX_BUTTONS = 3;
constexpr int MAX_LINES = 7;
constexpr int MAX_LINE_LEN = 128;

void init(const char* message, uint8_t buttons, uint8_t default_choice = 0);
void preferred_size(const char* title, int* out_w, int* out_h);
void draw();
void handle_mouse(const Montauk::WinEvent& ev);
void handle_key(const Montauk::KeyEvent& key);
void dismiss();
uint8_t selected_choice();
void cleanup();

} // namespace messagebox
