#ifndef APP_H
#define APP_H

#include <SDL2/SDL.h>

#include "channel.h"
#include "player.h"
#include "theme.h"
#include "ui.h"

typedef struct App {
    SDL_Window *window;
    SDL_Renderer *renderer;
    SDL_Texture *video_texture;
    int texture_width;
    int texture_height;
    AppMode mode;
    int running;
    int is_fullscreen;
    int theme_index;
    int theme_picker_open;
    int theme_picker_selection;
    int about_modal_open;
    int startup_handoff_active;
    int last_blackout_state;
    Uint32 startup_handoff_until;
    Uint32 last_guide_preview_update;
    Uint32 channel_banner_until;
    Uint32 channel_switch_lock_until;
    time_t app_start_time;
    Uint64 app_start_ticks;
    int guide_time_offset_minutes;
    int guide_selected_index;
    char numeric_input_buffer[4];
    int numeric_input_length;
    Uint32 numeric_input_timeout;
    int numeric_input_invalid;
    ChannelList channels;
    Player player;
    UiFonts fonts;
    UiCache ui_cache;
} App;

int app_init(App *app);
void app_run(App *app);
void app_destroy(App *app);

#endif
