#pragma once

#include <stdbool.h>
#include <time.h>
#include <mpv/client.h>
#include <so/term.h>

#define RX_UPDATE_COUNT 50

typedef struct {
  char uid[256];
  char name[256];
  char *addr;
  char *url;
  char *resolver;
} rx_station_t;

typedef struct {
  bool quit;
  rx_station_t *stations;
  size_t stations_len;
  const rx_station_t *curr;
  mpv_handle *ctx;
  int idx;
  int count;
  char *title;
  int loading;
  int error;
  char message[500];
  term_t term;
} rx_t;

void rx_init(rx_t *self);
void rx_update(rx_t *self);
void rx_draw(rx_t *self);
void rx_free(rx_t *self);
