//
//  MessageRecipientMode.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 "MessageRecipientMode.h"


NSInteger const MessageRecipientMode_TO_USER = 0;
NSInteger const MessageRecipientMode_TO_ROOM = 1;
NSInteger const MessageRecipientMode_TO_GROUP = 2;
NSInteger const MessageRecipientMode_TO_ZONE = 3;


@implementation MessageRecipientMode

@synthesize target = _target;
@synthesize mode = _mode;


-(id)initWithMode:(NSInteger)mode target:(id)target {
	
	if (self = [super init]) {
		
		if (mode < MessageRecipientMode_TO_USER || mode > MessageRecipientMode_TO_ZONE) {
			@throw [[NSException alloc] initWithName:@"ArgumentError" reason:[NSString stringWithFormat:@"Illegal recipient mode: %ld", (long)mode] userInfo:nil];
		}
		
		_mode = mode;
		self.target = target;
	}
	
	return self;
}


+(id)recipientModeWithMode:(NSInteger)mode target:(id)target {
	MessageRecipientMode *mrm = [[MessageRecipientMode alloc] initWithMode:mode target:target];
	return mrm;
}

@end
