//
//  BaseController.m
//  SFS2X
//
//  Original development by Infosfer Game Technologies Ltd. | http://www.infosfer.com.
//
//  Maintained and developed by A51 Integrated.
//  Copyright 2012 A51 Integrated | http://a51integrated.com. All rights reserved.
//

#import "BaseController.h"
#import "Logger.h"
#import "IMessage.h"

@implementation BaseController

@synthesize log = _log;
@dynamic id;


-(id)init {
	if ((self = [super init])) {
		self.log = [Logger getInstance];
		_id = -1;
	}
	
	return self;
}

-(NSInteger)id {
	return _id;
}

-(void)setId:(NSInteger)value {
	if (_id == -1) {
		_id = value;
	}
	else {
		@throw [[NSException alloc] initWithName:@"SFSError" reason:[NSString stringWithFormat:@"Controller ID is already set: %ld. Can't be changed at runtime!", (long)_id] userInfo:nil];
	}

	
}

-(void)handleMessage:(id <IMessage>)message {
	NSLog(@"System controller got request: %@", message);
}

@end
