//
//	CardJEModel.m
//
//	Create by Javen Zhang on 28/12/2016
//	Copyright © 2016. All rights reserved.
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "CardJEModel.h"

NSString *const kCardJEModelCreateBy = @"createBy";
NSString *const kCardJEModelCreateDate = @"createDate";
NSString *const kCardJEModelCreateName = @"createName";
NSString *const kCardJEModelDistributeDate = @"distributeDate";
NSString *const kCardJEModelEndDate = @"endDate";
NSString *const kCardJEModelIdField = @"id";
NSString *const kCardJEModelMemberId = @"memberId";
NSString *const kCardJEModelMemberName = @"memberName";
NSString *const kCardJEModelName = @"name";
NSString *const kCardJEModelOrderNumber = @"orderNumber";
NSString *const kCardJEModelRealPayTotal = @"realPayTotal";
NSString *const kCardJEModelRemak = @"remak";
NSString *const kCardJEModelStartDate = @"startDate";
NSString *const kCardJEModelState = @"state";
NSString *const kCardJEModelSysCompanyCode = @"sysCompanyCode";
NSString *const kCardJEModelSysOrgCode = @"sysOrgCode";
NSString *const kCardJEModelTicketNumber = @"ticketNumber";
NSString *const kCardJEModelTotal = @"total";
NSString *const kCardJEModelType = @"type";
NSString *const kCardJEModelUpdateBy = @"updateBy";
NSString *const kCardJEModelUpdateDate = @"updateDate";
NSString *const kCardJEModelUpdateName = @"updateName";

@interface CardJEModel ()
@end
@implementation CardJEModel




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kCardJEModelCreateBy] isKindOfClass:[NSNull class]]){
		self.createBy = dictionary[kCardJEModelCreateBy];
	}	
	if(![dictionary[kCardJEModelCreateDate] isKindOfClass:[NSNull class]]){
		self.createDate = dictionary[kCardJEModelCreateDate];
	}	
	if(![dictionary[kCardJEModelCreateName] isKindOfClass:[NSNull class]]){
		self.createName = dictionary[kCardJEModelCreateName];
	}	
	if(![dictionary[kCardJEModelDistributeDate] isKindOfClass:[NSNull class]]){
		self.distributeDate = dictionary[kCardJEModelDistributeDate];
	}	
	if(![dictionary[kCardJEModelEndDate] isKindOfClass:[NSNull class]]){
		self.endDate = dictionary[kCardJEModelEndDate];
	}	
	if(![dictionary[kCardJEModelIdField] isKindOfClass:[NSNull class]]){
		self.idField = dictionary[kCardJEModelIdField];
	}	
	if(![dictionary[kCardJEModelMemberId] isKindOfClass:[NSNull class]]){
		self.memberId = dictionary[kCardJEModelMemberId];
	}	
	if(![dictionary[kCardJEModelMemberName] isKindOfClass:[NSNull class]]){
		self.memberName = dictionary[kCardJEModelMemberName];
	}	
	if(![dictionary[kCardJEModelName] isKindOfClass:[NSNull class]]){
		self.name = dictionary[kCardJEModelName];
	}	
	if(![dictionary[kCardJEModelOrderNumber] isKindOfClass:[NSNull class]]){
		self.orderNumber = dictionary[kCardJEModelOrderNumber];
	}	
	if(![dictionary[kCardJEModelRealPayTotal] isKindOfClass:[NSNull class]]){
		self.realPayTotal = [dictionary[kCardJEModelRealPayTotal] doubleValue];
	}

	if(![dictionary[kCardJEModelRemak] isKindOfClass:[NSNull class]]){
		self.remak = dictionary[kCardJEModelRemak];
	}	
	if(![dictionary[kCardJEModelStartDate] isKindOfClass:[NSNull class]]){
		self.startDate = dictionary[kCardJEModelStartDate];
	}	
	if(![dictionary[kCardJEModelState] isKindOfClass:[NSNull class]]){
		self.state = dictionary[kCardJEModelState];
	}	
	if(![dictionary[kCardJEModelSysCompanyCode] isKindOfClass:[NSNull class]]){
		self.sysCompanyCode = dictionary[kCardJEModelSysCompanyCode];
	}	
	if(![dictionary[kCardJEModelSysOrgCode] isKindOfClass:[NSNull class]]){
		self.sysOrgCode = dictionary[kCardJEModelSysOrgCode];
	}	
	if(![dictionary[kCardJEModelTicketNumber] isKindOfClass:[NSNull class]]){
		self.ticketNumber = dictionary[kCardJEModelTicketNumber];
	}	
	if(![dictionary[kCardJEModelTotal] isKindOfClass:[NSNull class]]){
		self.total = [dictionary[kCardJEModelTotal] doubleValue];
	}

	if(![dictionary[kCardJEModelType] isKindOfClass:[NSNull class]]){
		self.type = dictionary[kCardJEModelType];
	}	
	if(![dictionary[kCardJEModelUpdateBy] isKindOfClass:[NSNull class]]){
		self.updateBy = dictionary[kCardJEModelUpdateBy];
	}	
	if(![dictionary[kCardJEModelUpdateDate] isKindOfClass:[NSNull class]]){
		self.updateDate = dictionary[kCardJEModelUpdateDate];
	}	
	if(![dictionary[kCardJEModelUpdateName] isKindOfClass:[NSNull class]]){
		self.updateName = dictionary[kCardJEModelUpdateName];
	}	
	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	if(self.createBy != nil){
		dictionary[kCardJEModelCreateBy] = self.createBy;
	}
	if(self.createDate != nil){
		dictionary[kCardJEModelCreateDate] = self.createDate;
	}
	if(self.createName != nil){
		dictionary[kCardJEModelCreateName] = self.createName;
	}
	if(self.distributeDate != nil){
		dictionary[kCardJEModelDistributeDate] = self.distributeDate;
	}
	if(self.endDate != nil){
		dictionary[kCardJEModelEndDate] = self.endDate;
	}
	if(self.idField != nil){
		dictionary[kCardJEModelIdField] = self.idField;
	}
	if(self.memberId != nil){
		dictionary[kCardJEModelMemberId] = self.memberId;
	}
	if(self.memberName != nil){
		dictionary[kCardJEModelMemberName] = self.memberName;
	}
	if(self.name != nil){
		dictionary[kCardJEModelName] = self.name;
	}
	if(self.orderNumber != nil){
		dictionary[kCardJEModelOrderNumber] = self.orderNumber;
	}
	dictionary[kCardJEModelRealPayTotal] = @(self.realPayTotal);
	if(self.remak != nil){
		dictionary[kCardJEModelRemak] = self.remak;
	}
	if(self.startDate != nil){
		dictionary[kCardJEModelStartDate] = self.startDate;
	}
	if(self.state != nil){
		dictionary[kCardJEModelState] = self.state;
	}
	if(self.sysCompanyCode != nil){
		dictionary[kCardJEModelSysCompanyCode] = self.sysCompanyCode;
	}
	if(self.sysOrgCode != nil){
		dictionary[kCardJEModelSysOrgCode] = self.sysOrgCode;
	}
	if(self.ticketNumber != nil){
		dictionary[kCardJEModelTicketNumber] = self.ticketNumber;
	}
	dictionary[kCardJEModelTotal] = @(self.total);
	if(self.type != nil){
		dictionary[kCardJEModelType] = self.type;
	}
	if(self.updateBy != nil){
		dictionary[kCardJEModelUpdateBy] = self.updateBy;
	}
	if(self.updateDate != nil){
		dictionary[kCardJEModelUpdateDate] = self.updateDate;
	}
	if(self.updateName != nil){
		dictionary[kCardJEModelUpdateName] = self.updateName;
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.createBy != nil){
		[aCoder encodeObject:self.createBy forKey:kCardJEModelCreateBy];
	}
	if(self.createDate != nil){
		[aCoder encodeObject:self.createDate forKey:kCardJEModelCreateDate];
	}
	if(self.createName != nil){
		[aCoder encodeObject:self.createName forKey:kCardJEModelCreateName];
	}
	if(self.distributeDate != nil){
		[aCoder encodeObject:self.distributeDate forKey:kCardJEModelDistributeDate];
	}
	if(self.endDate != nil){
		[aCoder encodeObject:self.endDate forKey:kCardJEModelEndDate];
	}
	if(self.idField != nil){
		[aCoder encodeObject:self.idField forKey:kCardJEModelIdField];
	}
	if(self.memberId != nil){
		[aCoder encodeObject:self.memberId forKey:kCardJEModelMemberId];
	}
	if(self.memberName != nil){
		[aCoder encodeObject:self.memberName forKey:kCardJEModelMemberName];
	}
	if(self.name != nil){
		[aCoder encodeObject:self.name forKey:kCardJEModelName];
	}
	if(self.orderNumber != nil){
		[aCoder encodeObject:self.orderNumber forKey:kCardJEModelOrderNumber];
	}
	[aCoder encodeObject:@(self.realPayTotal) forKey:kCardJEModelRealPayTotal];	if(self.remak != nil){
		[aCoder encodeObject:self.remak forKey:kCardJEModelRemak];
	}
	if(self.startDate != nil){
		[aCoder encodeObject:self.startDate forKey:kCardJEModelStartDate];
	}
	if(self.state != nil){
		[aCoder encodeObject:self.state forKey:kCardJEModelState];
	}
	if(self.sysCompanyCode != nil){
		[aCoder encodeObject:self.sysCompanyCode forKey:kCardJEModelSysCompanyCode];
	}
	if(self.sysOrgCode != nil){
		[aCoder encodeObject:self.sysOrgCode forKey:kCardJEModelSysOrgCode];
	}
	if(self.ticketNumber != nil){
		[aCoder encodeObject:self.ticketNumber forKey:kCardJEModelTicketNumber];
	}
	[aCoder encodeObject:@(self.total) forKey:kCardJEModelTotal];	if(self.type != nil){
		[aCoder encodeObject:self.type forKey:kCardJEModelType];
	}
	if(self.updateBy != nil){
		[aCoder encodeObject:self.updateBy forKey:kCardJEModelUpdateBy];
	}
	if(self.updateDate != nil){
		[aCoder encodeObject:self.updateDate forKey:kCardJEModelUpdateDate];
	}
	if(self.updateName != nil){
		[aCoder encodeObject:self.updateName forKey:kCardJEModelUpdateName];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.createBy = [aDecoder decodeObjectForKey:kCardJEModelCreateBy];
	self.createDate = [aDecoder decodeObjectForKey:kCardJEModelCreateDate];
	self.createName = [aDecoder decodeObjectForKey:kCardJEModelCreateName];
	self.distributeDate = [aDecoder decodeObjectForKey:kCardJEModelDistributeDate];
	self.endDate = [aDecoder decodeObjectForKey:kCardJEModelEndDate];
	self.idField = [aDecoder decodeObjectForKey:kCardJEModelIdField];
	self.memberId = [aDecoder decodeObjectForKey:kCardJEModelMemberId];
	self.memberName = [aDecoder decodeObjectForKey:kCardJEModelMemberName];
	self.name = [aDecoder decodeObjectForKey:kCardJEModelName];
	self.orderNumber = [aDecoder decodeObjectForKey:kCardJEModelOrderNumber];
	self.realPayTotal = [[aDecoder decodeObjectForKey:kCardJEModelRealPayTotal] doubleValue];
	self.remak = [aDecoder decodeObjectForKey:kCardJEModelRemak];
	self.startDate = [aDecoder decodeObjectForKey:kCardJEModelStartDate];
	self.state = [aDecoder decodeObjectForKey:kCardJEModelState];
	self.sysCompanyCode = [aDecoder decodeObjectForKey:kCardJEModelSysCompanyCode];
	self.sysOrgCode = [aDecoder decodeObjectForKey:kCardJEModelSysOrgCode];
	self.ticketNumber = [aDecoder decodeObjectForKey:kCardJEModelTicketNumber];
	self.total = [[aDecoder decodeObjectForKey:kCardJEModelTotal] doubleValue];
	self.type = [aDecoder decodeObjectForKey:kCardJEModelType];
	self.updateBy = [aDecoder decodeObjectForKey:kCardJEModelUpdateBy];
	self.updateDate = [aDecoder decodeObjectForKey:kCardJEModelUpdateDate];
	self.updateName = [aDecoder decodeObjectForKey:kCardJEModelUpdateName];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	CardJEModel *copy = [CardJEModel new];

	copy.createBy = [self.createBy copy];
	copy.createDate = [self.createDate copy];
	copy.createName = [self.createName copy];
	copy.distributeDate = [self.distributeDate copy];
	copy.endDate = [self.endDate copy];
	copy.idField = [self.idField copy];
	copy.memberId = [self.memberId copy];
	copy.memberName = [self.memberName copy];
	copy.name = [self.name copy];
	copy.orderNumber = [self.orderNumber copy];
	copy.realPayTotal = self.realPayTotal;
	copy.remak = [self.remak copy];
	copy.startDate = [self.startDate copy];
	copy.state = [self.state copy];
	copy.sysCompanyCode = [self.sysCompanyCode copy];
	copy.sysOrgCode = [self.sysOrgCode copy];
	copy.ticketNumber = [self.ticketNumber copy];
	copy.total = self.total;
	copy.type = [self.type copy];
	copy.updateBy = [self.updateBy copy];
	copy.updateDate = [self.updateDate copy];
	copy.updateName = [self.updateName copy];

	return copy;
}
@end