//  File testmultilist.cpp

#include <iostream>
#include "multilist.h"

using namespace std;

int main()
{
    Multilist list;
    bool done = false;
    int id;
    char command;
    string name;
    while ( !done )
    {
        cin >> command;
        switch ( command )
        {
           case '+':
               cin >> id >> name;
               cout << "Inserting " << id << ", " << name << endl;
               if ( !list.insert(id, name) )
                   cout << "Cannot insert " << name << endl;
               break;
           case '-':
               cin >> id >> name;
               cout << "Removing " << id << ", " << name << endl;
               if ( !list.remove(id, name) )
                   cout << "Cannot remove " << name << endl;
               break;
           case 'n':
               cout << "Printing by name " << endl;
               list.print_by_name();
               break;
           case 'm':
               cout << "Printing by name reverse " << endl;
               list.print_by_name_reverse();
               break;
           case 'i':
               cout << "Printing by ID number " << endl;
               list.print_by_ID();
               break;
           case 'j':
               cout << "Printing by ID number reverse " << endl;
               list.print_by_ID_reverse();
               break;
           case 'Q':
           case 'q':
               done = true;
               break;
        }
    }
}
