#include "deactivate_msg_2.h"

// Author: Steve Talbot

deactivate_msg_2:: deactivate_msg_2(){
}

deactivate_msg_2:: ~deactivate_msg_2(){
}

bool deactivate_msg_2:: deactivate_msg( Data* data_ ){

	// this method overrides the default method "deactivate_msg()" from the
	// superclass "deactivate_msg_1" ..

	AccountInfo* accountInfo = data_->getCurrentAccountInfo();

	// update "accountInfo" to make sure it is "inactive" ..
	if( accountInfo->getIsActive() == true )
		accountInfo->setIsActive( false );

	int id = accountInfo->getID();

	cout << "Account deactivated (id: " << id << ")" << endl;

	// indicate that this change to the "account info" object means
	// that this object needs to be written to file during the logout operation ..
	if ( data_->getNeedsToBeFlushedToFile( accountInfo->getID() ) == false )
		data_->setNeedsToBeFlushedToFile( accountInfo->getID(), true );

	// reset "tempPin" ..
	data_->setTempPin( -1 );

	return true;


}