#ifndef DIALOGS_H
#define DIALOGS_H

#include <gtk/gtk.h>
#include "player.h"
#include "playlist.h"
#include "keybinds.h"

/* Forward declaration */
struct PluginManager;

/* Preferences dialog */
typedef struct {
    double default_volume;
    gboolean remember_position;
    gboolean show_playlist;
    gboolean auto_resize;
    gboolean hide_cursor_windowed;
    gboolean remember_last_dir;
    gboolean use_mpris;
    gboolean open_in_new_window;
    gboolean seekbar_direct_jump;
    gboolean hide_focus_rect;
    gboolean enable_osd;
    gboolean enable_chapters;
    gboolean enable_volume_boost;
    gboolean mouse_wheel_seeks;
    char *last_dir;
    char *screenshot_directory;
    char *screenshot_format;
    char *mpv_config_path;
    /* Subtitle settings */
    double sub_delay;
    int sub_pos;
    double sub_scale;
    char *sub_font;
    int sub_font_size;
    char *sub_color;
    int sub_color_opacity;
    char *sub_border_color;
    double sub_border_size;
    int sub_border_opacity;
    gboolean sub_border_enabled;
    char *sub_shadow_color;
    double sub_shadow_offset;
    int sub_shadow_opacity;
    gboolean sub_shadow_enabled;
    gboolean sub_bold;
    gboolean sub_italic;
} Preferences;

Preferences* preferences_new(void);
void preferences_free(Preferences *prefs);
void preferences_load(Preferences *prefs);
void preferences_save(Preferences *prefs);
typedef void (*PreferencesApplyCallback)(gpointer data);
gboolean dialogs_show_preferences(GtkWindow *parent, Preferences *prefs, struct PluginManager *pm, KeybindManager *km, int initial_tab, PreferencesApplyCallback apply_cb, gpointer user_data);

/* File dialogs */
GSList* dialogs_open_files(GtkWindow *parent, Preferences *prefs);
char* dialogs_open_directory(GtkWindow *parent, Preferences *prefs);
char* dialogs_open_url(GtkWindow *parent, Preferences *prefs);
char* dialogs_open_subtitle(GtkWindow *parent, Preferences *prefs);
char* dialogs_save_playlist(GtkWindow *parent, Preferences *prefs);
char* dialogs_save_screenshot(GtkWindow *parent);

/* About and Keybinds dialogs */
void dialogs_show_about(GtkWindow *parent);
void dialogs_show_keybinds(GtkWindow *parent, KeybindManager *km);

/* Go to time dialog */
double dialogs_goto_time(GtkWindow *parent, double current_time, double duration);

/* Speed selection dialog */
double dialogs_select_speed(GtkWindow *parent, double current_speed);

/* Script Manager dialog */
void dialogs_show_script_manager(GtkWindow *parent, Player *player);
GtkWidget* dialogs_create_script_manager_widget(Player *player);

#endif /* DIALOGS_H */
