#include "Inactive.h"

// Author: Steve Talbot

Inactive:: Inactive(){

}

Inactive:: ~Inactive(){
}

bool Inactive:: logout( int& nextStateId_ ){

	// save “currentAccountInfo” to file (persistence) ..

	nextStateId_ = _stateIds->IDLE;

	return true;

}

bool Inactive:: withdraw( bool isLessThanMinBalance_m, int& nextStateId_ ){

// “isLessThanMinBalance_” and "nextStateId_" passed in from Account (not used, interface only) ..

	bool result = getOutputProcessor()->inactive_account_msg();

	getOutputProcessor()->display_menu();

	return result;

}

bool Inactive:: deposit( bool isLessThanMinBalance_, int& nextStateId_ ){

	// “isLessThanMinBalance_” and "nextStateId_" passed in from Account (not used, interface only) ..

	bool result = getOutputProcessor()->inactive_account_msg();

	getOutputProcessor()->display_menu();

	return result;

}

bool Inactive:: balance(){

	bool result = getOutputProcessor()->inactive_account_msg();

	getOutputProcessor()->display_menu();

	return result;

}

bool Inactive:: activate( bool isPinCorrect_, bool isAboveMinBalance_, int& nextStateId_ ){

	// “hasCorrectPin_”, “isAboveMinBalance_" and "nextStateId_" passed in from the Account..

	bool result = false;

	if ( isPinCorrect_ == true ) {

		result = correct_pin( isAboveMinBalance_, nextStateId_ );

	} else {

		// no limit on number attempts to deactivate ..

		result = incorrect_pin();

	}

	return result;

}

bool Inactive:: correct_pin( bool isAboveMinBalance_, int& nextStateId_ ){

	// “isAboveMinBalance_” and "nextStateId_" passed in from the Account..

	bool result = false;

	if( isAboveMinBalance_ == true ){

		result = above_min_balance( nextStateId_ );

	} else {

		result = below_min_balance( nextStateId_ );

	}

	return result;

}

bool Inactive:: incorrect_pin(){

	// no limit on number attempts to deactivate ..

	bool result = getOutputProcessor()->incorrect_pin_msg();

	getOutputProcessor()->display_menu();

	return result;

}

bool Inactive:: above_min_balance( int& nextStateId_ ){

	nextStateId_ = _stateIds->READY;

	bool result = getOutputProcessor()->activate_msg();

	getOutputProcessor()->display_menu();

	return result;

}

bool Inactive:: below_min_balance( int& nextStateId_ ){

	nextStateId_ = _stateIds->OVERDRAWN;

	bool result = getOutputProcessor()->activate_msg();

	getOutputProcessor()->display_menu();

	return result;

}

// these are only necessary if the parent class defines these
// methods are "abstract" (i.e.: pure virtual) methods ..

//bool Inactive:: correct_login( int& nextStateId_ ){ /*empty implementation*/ return false; }						// Idle();
//bool Inactive:: incorrect_login(){ /*empty implementation*/ return false; }										// Idle();

//bool Inactive:: correct_pin( int& nextStateId_ ){ /*empty implementation*/ return false; }						// Overdrawn(); Ready();
//bool Inactive:: correct_pin( bool isAboveMinBalance_, bool isActive_, int& nextStateId_ ){ /*empty implementation*/ return false; }	// CheckPin();

//bool Inactive:: incorrect_pin( bool attemptsRemain_, int& nextStateId_ ){ /*empty implementation*/ return false; }// CheckPin();

//bool Inactive:: attempts_remain(){ /*empty implementation*/ return false; }										// CheckPin();
//bool Inactive:: too_many_attempts(int& nextStateId_){ /*empty implementation*/ return false; }					// CheckPin();

//bool Inactive:: active(bool isAboveMinBalance_, int& nextStateId_){ /*empty implementation*/ return false; }		// CheckPin();
//bool Inactive:: inactive(int& nextStateId_){ /*empty implementation*/ return false; }								// CheckPin();

//bool Inactive:: deactivate( bool isPinCorrect_, int& nextStateId_ ){ /*empty implementation*/ return false; }		// Overdrawn(); Ready();

//bool Inactive:: diff_more_or_equal_to_min_balance(){ /*empty implementation*/ return false; }						// Ready();
//bool Inactive:: diff_less_than_min_balance( int& nextStateId_ ){ /*empty implementation*/ return false; }			// Ready();

//bool Inactive:: sum_more_or_equal_to_min_balance( int& nextStateId_ ){ /*empty implementation*/ return false; }	// Overdrawn();
//bool Inactive:: sum_less_than_min_balance(){ /*empty implementation*/ return false; }								// Overdrawn();

