/* ****************************************************************************
 * File:      screen.h
 * Date:      25 Mar 2026
 * Author:    Andrew Levido
 *
 * Copyright 2026 Imbrius Pty Ltd - All Rights Reserved
 *
 *****************************************************************************/
#ifndef _screen_H
#define _screen_H

#include "resources.h"
#ifdef __cplusplus
extern "C" {
#endif

/* Description ---------------------------------------------------------------*/

/* Includes ------------------------------------------------------------------*/
#include "graphics.h"

/* Defines -------------------------------------------------------------------*/
#define SCRN_MAX_TEXT       30
#define SCRN_CENTRED        0xffff
/* Typedefs & Enumerations ---------------------------------------------------*/

typedef enum {SCRN_NODE_NONE, SCRN_NODE_RED, SCRN_NODE_GRN, SCRN_NODE_BLU} scrn_node_id_t;

typedef struct {
  uint16_t x;
  uint16_t y;
  char text[SCRN_MAX_TEXT];
  uint16_t colour;
} screen_text_t;

typedef struct {
  uint16_t x;
  uint16_t y;
  const res_image_t * image;
  uint16_t colour;
} screen_image_t;


typedef struct {
  uint16_t x;
  uint16_t y;
} screen_node_t;

typedef struct {
  uint16_t bg_colour;
  const screen_text_t * title;
  const screen_image_t * image1;
  const screen_image_t * image2;
  const screen_text_t  * text1;
  const screen_text_t * text2;
  const screen_node_t * top_node;
  const screen_node_t * left_node;
  const screen_node_t * bottom_node;
} screen_t;

typedef struct {
  const screen_t * screen;
  char * string1_override;
  char * string2_override;
  scrn_node_id_t top_node_id;
  scrn_node_id_t left_node_id;
  scrn_node_id_t bottom_node_id;
} screen_desc_t;

extern const screen_t scrn_splash;
extern const screen_t scrn_wait;
extern const screen_t scrn_error;
extern const screen_t scrn_diode;
extern const screen_t scrn_schottky;
extern const screen_t scrn_led;
extern const screen_t scrn_zener;
extern const screen_t scrn_led_b2b;
extern const screen_t scrn_diode_b2b;
extern const screen_t scrn_bjt_npn;
extern const screen_t scrn_bjt_npn_diode;
extern const screen_t scrn_darlington_npn;
extern const screen_t scrn_darlington_npn_diode;
extern const screen_t scrn_bjt_pnp;
extern const screen_t scrn_bjt_pnp_diode;
extern const screen_t scrn_darlington_pnp;
extern const screen_t scrn_darlington_pnp_diode;
extern const screen_t scrn_mosfet_pch;
extern const screen_t scrn_mosfet_nch;
extern const screen_t scrn_jfet_pch;
extern const screen_t scrn_jfet_nch;
extern const screen_t scrn_mosfet_pch;
extern const screen_t scrn_depletion_mosfet_nch;
extern const screen_t scrn_igbt;
extern const screen_t scrn_igbt_diode;
extern const screen_t scrn_diode_pair_aa;
extern const screen_t scrn_led_pair_aa;
extern const screen_t scrn_schottky_pair_aa;
extern const screen_t scrn_schottky_pair_ak;
extern const screen_t scrn_diode_pair_ak;
extern const screen_t scrn_diode_pair_kk;
extern const screen_t scrn_led_pair_kk;
extern const screen_t scrn_schottky_pair_kk;
extern const screen_t scrn_thyristor;
extern const screen_t scrn_triac;

/* Public Functions Declarations ---------------------------------------------*/
void scrn_draw(screen_desc_t * screenconfig);


/* Task Function -------------------------------------------------------------*/

/* Interrupt Service Routine Declarations ------------------------------------*/

#ifdef __cplusplus
}
#endif

#endif

/* End screen */