/*
 * File: Hierarchical_Menu.c
 *
 * Created: Created: Sunday September 2025 07:47:28
 *   Author: Chris
 */
#include "Hierarchical_Menu.h"


// ============================================================================================
// Includes
#include "Screens.h"
#include "EEPROM_M24C64.h"


// ============================================================================================
// Forward Declaration
static const Menu_Item _Menu_Items_MIDI_Config[];
static const Menu_Item _Menu_Items_MIDI_Notes[];  
static const Menu_Item _Menu_Items_MIDI_Pause[];
static const Menu_Item _Menu_Items_MIDI[];

static const Menu_List _Menu_List_MIDI_Config;
static const Menu_List _Menu_List_MIDI_Notes;  
static const Menu_List _Menu_List_MIDI_Pause;
static const Menu_List _Menu_List_MIDI;
const Hierarchical_Menu _Hierarchical_Menu_MIDI;

// ============================================================================================
// Variables
static const Menu_Item _Menu_Items_MIDI_Config[] = {
    { "MIDI Channel"    , NULL, false, &_Menu_List_MIDI_Config, NONE, "", NULL },
	{ "Select Octave"   , NULL, false, &_Menu_List_MIDI_Config, NONE, "", NULL },
	{ "Skip Note Off"   , NULL, false, &_Menu_List_MIDI_Config, BOOL, "Skip Note Off", (void*)(&_EEPROM_Content.Channel_MIDI_Configuration[0].Skip_Note_Off_Event) },
	{ "Back"            , NULL, true , &_Menu_List_MIDI_Config, NONE, "", NULL }
};

static const Menu_List _Menu_List_MIDI_Config = {
    .Title = "MIDI Config",
    .Items = _Menu_Items_MIDI_Config,
    .Item_Count = sizeof(_Menu_Items_MIDI_Config) / sizeof(Menu_Item),
    .Parent = &_Menu_Items_MIDI[0],
    .Root = &_Hierarchical_Menu_MIDI
};


static const Menu_Item _Menu_Items_MIDI_Notes[] = {
    { "Red"             , NULL, false, &_Menu_List_MIDI_Notes, NONE, "", NULL },
	{ "Green"           , NULL, false, &_Menu_List_MIDI_Notes, NONE, "", NULL },
	{ "Blue"            , NULL, false, &_Menu_List_MIDI_Notes, NONE, "", NULL },
	{ "Default Notes"   , NULL, false, &_Menu_List_MIDI_Notes, NONE, "", NULL },
	{ "Back"            , NULL, true , &_Menu_List_MIDI_Notes, NONE, "", NULL }
};

static const Menu_List _Menu_List_MIDI_Notes = {
    .Title = "Color Notes",
    .Items = _Menu_Items_MIDI_Notes,
    .Item_Count = sizeof(_Menu_Items_MIDI_Notes) / sizeof(Menu_Item),
    .Parent = &_Menu_Items_MIDI[1],
    .Root = &_Hierarchical_Menu_MIDI
};


static const Menu_Item _Menu_Items_MIDI_Pause[] = {
    { "Enable"      , NULL, false, &_Menu_List_MIDI_Pause, BOOL, "Enable Pause Light", (void*)(&_EEPROM_Content.Pause_Light_Configuration[0].Enabled) },
	{ "Color"       , NULL, false, &_Menu_List_MIDI_Pause, RGB , "Pause Light Color", (void*)(&_EEPROM_Content.Pause_Light_Configuration[0].Color) },
	{ "Fade Speed"  , NULL, false, &_Menu_List_MIDI_Pause, NONE, "", NULL },
	{ "Timeout"     , NULL, false, &_Menu_List_MIDI_Pause, NONE, "", NULL },
	{ "Reset"       , NULL, false, &_Menu_List_MIDI_Pause, NONE, "", NULL },
	{ "Item 1"      , NULL, false, &_Menu_List_MIDI_Pause, NONE, "", NULL },
	{ "Item 2"      , NULL, false, &_Menu_List_MIDI_Pause, NONE, "", NULL },
	{ "Item 3"      , NULL, false, &_Menu_List_MIDI_Pause, NONE, "", NULL },
	{ "Item 4"      , NULL, false, &_Menu_List_MIDI_Pause, NONE, "", NULL },
	{ "Item 5"      , NULL, false, &_Menu_List_MIDI_Pause, NONE, "", NULL },
	{ "Item 6"      , NULL, false, &_Menu_List_MIDI_Pause, NONE, "", NULL },
	{ "Back"        , NULL, true , &_Menu_List_MIDI_Pause, NONE, "", NULL }
};

static const Menu_List _Menu_List_MIDI_Pause = {
    .Title = "Pause Light",
    .Items = _Menu_Items_MIDI_Pause,
    .Item_Count = sizeof(_Menu_Items_MIDI_Pause) / sizeof(Menu_Item),
    .Parent = &_Menu_Items_MIDI[2],
    .Root = &_Hierarchical_Menu_MIDI
};


static const Menu_Item _Menu_Items_MIDI[] = {
    { "MIDI Config" , &_Menu_List_MIDI_Config   , false, &_Menu_List_MIDI },
	{ "Color Notes" , &_Menu_List_MIDI_Notes    , false, &_Menu_List_MIDI },
	{ "Pause Light" , &_Menu_List_MIDI_Pause    , false, &_Menu_List_MIDI },
	{ "Back"        , NULL                      , true , &_Menu_List_MIDI }
};

static const Menu_List _Menu_List_MIDI = {
    .Title = "MIDI",
    .Items = _Menu_Items_MIDI,
    .Item_Count = sizeof(_Menu_Items_MIDI) / sizeof(Menu_Item),
    .Parent = NULL,
    .Root = &_Hierarchical_Menu_MIDI
};


const Hierarchical_Menu _Hierarchical_Menu_MIDI = {
    .List = &_Menu_List_MIDI,
    .Parent_Function = &Screen_Setup_Settings,
    .Parent_Selected_Setting = 0
};


// ============================================================================================
// Function Declarations


/*******************************************************************
    Functions
*******************************************************************/


/*******************************************************************
    Internal Functions
*******************************************************************/

