//import NetworkConnection;
//import Mailbox;
//import MailMessage;
import SimpleOutput;
import SimpleInput;
import Prompter;
import ConnectionException;
/**
 *  
 * The textual interface for our CS152 e-mail client.
 *
 * purpose:  Allows us to access our e-mail client from a textual interface
 *           (such as telnet or a similar program).
 * parameters
 * preconditions
 * Post: You will be able to get your mail, read it, compose, and 
 *       hopefully everything else you would expect from a mail client.
 * problems/exceptions
 * produces:  This allows to you get your mail, read it, compose, and 
 *            hopefully everything else you would expect from a mail client.
 * 
 * @author Paul Carlson
 * @author Sierra Soleil
 * @author Binyam Taddese
 *
 * @version 1.7 of November 1999
 *
 *
 *  11/2:  changed main method. (Used Gmail for format). this now stores 
 *  PC     username and password.  now we need to
 *         create a network connection and a mailbox with this information.
 *
 *  11/3:  Added material from our narrative in class.  
 *  PC     Doesn't compile any more.
 *
 *  11/8:  Added Prompter object.  Still compiles.
 *  PC
 *
 *  11/21: MailBox people are integrated!  Hooray!  Well, mostly...
 *  PC
 */

public class TUI {
    // +--------+--------------------------------------------------
    // | Fields |
    // +--------+
    
    /* user's log-in name */
    protected String username;
    
    /* user's password */
    protected String password;
 
    
    // +--------------+--------------------------------------------
    // | Constructors |
    // +--------------+
    protected TUI() {
        SimpleOutput out = new SimpleOutput();
        SimpleInput in = new SimpleInput();
        try {
        Mailbox box = new Mailbox();
        out.println("\n\n                       Welcome to TUI!!!!!!!!\n\n\n");
        // let's get their name
        out.print("Username: ");
        // read and store what they write
        username=in.readString();
        // let's get their password
        out.print("Password: ");
        // read and store what they write
        password=in.readString();
        out.println("\n");

        // create a network connection and mailbox using these two inputs
            box.login(username,password);
        
        // ask them what they want to do.
        out.print("Possible commands:  Address (Address book)\n"+
                  "                    new     (New Mail)\n"+
                  "                    new folder  (Create a new folder)\n"+ 
                  "                    delete folder   (Delete a folder)\n"+ 
                  "                    inbox   (All your mail)\n"+
                  "                    quit    (Exit TUI)\n"+
                  "                    create  (Make a new message)\n"+
                  "                    index (See all your folders)\n"+
                  "                    options (Change your options)\n"+
                  "                    list    (see these options again)"+ 
                  "                    +\n\n");
        new Prompter(box);

        // save options before exiting.....
        // obstensibly done by options people...

        } //try
        catch (Exception e) {out.println("Something messed up in TUI");}
    } // TUI()
    
    // +------+----------------------------------------------------
    // | Main |
    // +------+

    // Let's get it on!
    public static void main(String[] args) {
        new TUI();
    } // main method

} // TUI class

