//
//  User.m
//  LifeLog
//
//  Created by Nguyen Van Phong on 7/30/17.
//  Copyright © 2017 PhongNV. All rights reserved.
//

#import "User.h"

@implementation User
- (id)initWithCoder:(NSCoder *)decoder {
    self = [super init];
    if (!self) {
        return nil;
    }
    
    self.user_id = [decoder decodeObjectForKey:@"user_id"];
    self.username = [decoder decodeObjectForKey:@"username"];
    self.password = [decoder decodeObjectForKey:@"password"];
    self.full_name = [decoder decodeObjectForKey:@"full_name"];
    self.nickname = [decoder decodeObjectForKey:@"nickname"];
    self.birthday = [decoder decodeObjectForKey:@"birthday"];
    self.height = [decoder decodeFloatForKey:@"height"];
    self.weight = [decoder decodeFloatForKey:@"weight"];
    self.gender = [decoder decodeIntForKey:@"gender"];
    self.address = [decoder decodeObjectForKey:@"address"];
    self.user_description = [decoder decodeObjectForKey:@"user_description"];
    self.email = [decoder decodeObjectForKey:@"email"];
    self.phone = [decoder decodeObjectForKey:@"phone"];
    self.created_at = [decoder decodeObjectForKey:@"created_at"];
    self.physical_activity = [decoder decodeObjectForKey:@"physical_activity"];
    self.profile_image = [decoder decodeObjectForKey:@"profile_image"];
    self.updated_at = [decoder decodeObjectForKey:@"updated_at"];
    self.delete_flag = [decoder decodeIntForKey:@"delete_flag"];
    self.fat_rate = [decoder decodeIntForKey:@"fat_rate"];
    self.profiles_share = [decoder decodeIntForKey:@"profiles_share"];
    self.remember_me = [decoder decodeIntForKey:@"remember_me"];
    self.sound_notifications_share = [decoder decodeIntForKey:@"sound_notifications_share"];
    self.spend_calo_in_day = [decoder decodeIntForKey:@"spend_calo_in_day"];
    self.target = [decoder decodeIntForKey:@"target"];
  
    return self;
}

- (void)encodeWithCoder:(NSCoder *)encoder {
    [encoder encodeObject:self.user_id forKey:@"user_id"];
    [encoder encodeObject:self.username forKey:@"username"];
    [encoder encodeObject:self.password forKey:@"password"];
    [encoder encodeObject:self.full_name forKey:@"full_name"];
    [encoder encodeObject:self.nickname forKey:@"nickname"];
    [encoder encodeObject:self.birthday forKey:@"birthday"];
    [encoder encodeFloat:self.height forKey:@"height"];
    [encoder encodeFloat:self.weight forKey:@"weight"];
    [encoder encodeInt:self.gender forKey:@"gender"];
    [encoder encodeObject:self.address forKey:@"address"];
    [encoder encodeObject:self.user_description forKey:@"user_description"];
    [encoder encodeObject:self.email forKey:@"email"];
    [encoder encodeObject:self.phone forKey:@"phone"];
    [encoder encodeObject:self.created_at forKey:@"created_at"];
    [encoder encodeObject:self.physical_activity forKey:@"physical_activity"];
    [encoder encodeObject:self.profile_image forKey:@"profile_image"];
    [encoder encodeObject:self.updated_at forKey:@"updated_at"];
    [encoder encodeInt:self.delete_flag forKey:@"delete_flag"];
    [encoder encodeInt:self.fat_rate forKey:@"fat_rate"];
    [encoder encodeInt:self.profiles_share forKey:@"profiles_share"];
    [encoder encodeInt:self.remember_me forKey:@"remember_me"];
    [encoder encodeInt:self.sound_notifications_share forKey:@"sound_notifications_share"];
    [encoder encodeInt:self.spend_calo_in_day forKey:@"spend_calo_in_day"];
    [encoder encodeInt:self.target forKey:@"target"];
}
@end
