#include <stdio.h> // Include stdio.h for basic functions
#include <string.h> // Include string.h for string functions
#include <ctype.h> // Include ctype.h for character analysis functions
#include <stdlib.h> // Include stdlib.h for exit()
#include <stdbool.h> // Include stdbool.h for booleans

#include "functions.h" // Include custom functions.h file

int main(void) { // Start main function

    const int maxInputChars = 250; // Declare and initialize maxInputChars as a constant int with value 250
    char userInputText[maxInputChars]; // Declare char array userInputText of size maxInputChars

    printf("Enter a sample text:\n"); // Prompt for sample text
    fgets(userInputText, maxInputChars, stdin); // Store keyboard input as userInputText
    printf("\n"); // Print new line

    printf("You entered: %s\n", userInputText); // Output stored userInputText

    while (1) { // While loop that serves menu functions until end condition is met
        PrintMenu(); // Call PrintMenu()

        char menuInput = '\0'; // Declare and initialize menuInput of type char as a null character
        while (1) { // While loop that gets menuInput until the input matches one of the available menu options
            menuInput = GetMenuInput(); // Store menuInput as the return of GetMenuInput()
            if (menuInput == 'c' || menuInput == 'w' || menuInput == 'f' || menuInput == 'r' || menuInput == 's' || menuInput == 'q') { // If menuInput is c, w, f, r, s, or q (valid menu options)
                break; // Break current while loop
            }
        }

        ExecuteMenu(menuInput, userInputText); // Call ExecuteMenu() with arguments menuInput and userInputText
    }

    return 0; // Return end code

}