#include "deposit_1.h"

// Author: Steve Talbot

deposit_1:: deposit_1(){
}

deposit_1:: ~deposit_1(){

}

bool deposit_1:: deposit( Data* data_, MDA_EFSM* M_ ){

	bool isLessThanMinBalance = true;

	// calculate the “deposit” operation ..

	int currentBalance = data_->getCurrentAccountInfo()->getB();
	int depositAmount = data_->getD();

	int result = ( currentBalance + depositAmount );

	// check whether this is an “overdraw” ..

	int minBalance = data_->getMinBalance();

	if( result >= minBalance )
		isLessThanMinBalance = false;

	M_->deposit( isLessThanMinBalance );

	// deposit always allowed, so this is always true ..
	return true;


}
