#include "Account.h"
#include "UserInterface.h"

// Author: Steve Talbot

using namespace std;

/*
 * This is the main application component which runs the "project" program.
 * The "main()" method resides in this file.
 */

 /*
 * In order to run this program, right-click the project folder simply called
 * "project" in the FileChooser view titled "C/C++ Projects" tab on the left.
 * Select "Run as->Run Local C/C++ Application".
 */

  /*
 * Output from the program is shown in the text panel view tab named "Console".
 */

int main(){

	UserInterface ui;

	ui.startProgram();

}

 /*
 * The "test_basic()" method was a series of tests conducted to debug the
 * functionality of the program.
 */

void test_basic(){

	Account* account = new Account();

	int p = 10;

	int y = 15;

	int a = 50;

	cout << "main()           account->getState(): " << account->getState() << endl << endl;
	cout << "main()      account->getMinBalance(): " << account->getMinBalance() << endl << endl;
	cout << "main()     account->getMaxAttempts(): " << account->getMaxAttempts() << endl << endl;
	cout << "main() account->getOverdrawPenalty(): " << account->getOverdrawPenalty() << endl << endl;

	bool result_open_account = account->open_account( p, y, a );
	cout << "main() result_open_account: " << result_open_account << endl << endl;

	bool result_login1 = account->login( y );
	cout << "main() result_login1: " << result_login1 << endl << endl;

	bool result_pin1 = account->pin( (p+1) );
	cout << "main() result_pin1: " << result_pin1 << endl << endl;

	bool result_pin2 = account->pin( (p+1) );
	cout << "main() result_pin2: " << result_pin2 << endl << endl;

	bool result_pin3 = account->pin( (p+1) );
	cout << "main() result_pin3: " << result_pin3 << endl << endl;

	bool result_pin4 = account->pin( (p) ); // doesn't work .. must re-login, b/c in IDLE state now!
	cout << "main() result_pin4: " << result_pin4 << endl << endl;



	bool result_login2 = account->login( y );
	cout << "main() result_login2: " << result_login2 << endl << endl;

	bool result_pin5 = account->pin( (p) ); // works, b/c correct Y & P!
	cout << "main() result_pin5: " << result_pin5 << endl << endl;


	cout << "main() account->getState(): " << account->getState() << endl << endl;


	bool result_balance1 = account->balance();
	cout << "main() result_balance1: " << result_balance1 << endl << endl;

	bool result_deposit1 = account->deposit( 5 );
	cout << "main() result_deposit1: " << result_deposit1 << endl << endl;

	bool result_balance2 = account->balance();
	cout << "main() result_balance2: " << result_balance2 << endl << endl;

	bool result_withdraw1 = account->withdraw( 10 );
	cout << "main() result_withdraw1: " << result_withdraw1 << endl << endl;

	bool result_balance3 = account->balance();
	cout << "main() result_balance3: " << result_balance3 << endl << endl;

	bool result_withdraw2 = account->withdraw( 46 );
	cout << "main() result_withdraw2: " << result_withdraw2 << endl << endl;

	bool result_balance4 = account->balance();
	cout << "main() result_balance4: " << result_balance4 << endl << endl;


	cout << "main() account->getState(): " << account->getState() << endl << endl;


	bool result_withdraw3 = account->withdraw( 10 );
	cout << "main() result_withdraw3: " << result_withdraw3 << endl << endl;

	bool result_balance5 = account->balance();
	cout << "main() result_balance5: " << result_balance5 << endl << endl;


	cout << "main() account->getState(): " << account->getState() << endl << endl;


	bool result_deposit2 = account->deposit( 25 );
	cout << "main() result_deposit2: " << result_deposit2 << endl << endl;

	bool result_balance6 = account->balance();
	cout << "main() result_balance6: " << result_balance6 << endl << endl;


	cout << "main() account->getState(): " << account->getState() << endl << endl;


	bool result_deposit3 = account->deposit( 5 );
	cout << "main() result_deposit3: " << result_deposit3 << endl << endl;

	bool result_balance7 = account->balance();
	cout << "main() result_balance7: " << result_balance7 << endl << endl;


	cout << "main() account->getState(): " << account->getState() << endl << endl;


	bool result_deactivate1 = account->deactivate();
	cout << "main() result_deactivate1: " << result_deactivate1 << endl << endl;

	bool result_balance8 = account->balance();
	cout << "main() result_balance8: " << result_balance8 << endl << endl;

	cout << "main() account->getState(): " << account->getState() << endl << endl;

	bool result_activate1 = account->activate();
	cout << "main() result_activate1: " << result_activate1 << endl << endl;

	bool result_balance9 = account->balance();
	cout << "main() result_balance9: " << result_balance9 << endl << endl;

	cout << "main() account->getState(): " << account->getState() << endl << endl;


}
