/*************************************************
* ADS Praktikum 1.1
* main.cpp
*
*************************************************/
#define CATCH_CONFIG_RUNNER

#include <iostream>
#include <string>
#include "Ring.h"
#include "catch.h"

using namespace std;

void print_menu() {
    cout << "====================================" << endl
        << " SuperBackUp-Organizer over 9000, by. Son Goku" << endl
        << "====================================" << endl
        << "1) Backup anlegen" << endl
        << "2) Backup suchen" << endl
        << "3) Alle Backups ausgeben" << endl
        << "4) Programm beenden" << endl
        << "?> ";
}

int main() {
    int result = Catch::Session().run();

    Ring ring;

    while (true) {
        print_menu();

        int engb;
        cin >> engb;

        switch (engb) {
            case 1: {
                cout << "+ Neuen Datensatz einfuegen" << endl
                    << "Beschreibung ?> ";
                string desc;
                cin >> desc;
                cout << "Daten ?> ";
                string data;
                cin >> data;
                ring.addNewNode(desc, data);
                cout << "+ Datensatz hinzugefuegt." << endl;
                break;
            }

            case 2: {
                cout << "+ Nach welchen Daten soll gesucht werden?" << endl
                    << "?> ";
                string to_find;
                cin >> to_find;
                ring.printNode(to_find);
                break;
            }

            case 3:
                ring.print();
                break;

            case 4:
                return result;
                
            default:
                cout << "Invalid selection!" << endl;
        }
    }


    system("Pause");
    return result;
}