//
//  IValue.m
//  react-native-bt-device
//
//  Created by Ran Zhao on 9/2/24.
//

#import "IValue.h"

@implementation IValue

- (instancetype)initWithCurrentTime:(NSDate *)currentTime current:(NSNumber *)current {
    self = [super init];
    if (self) {
        self.current = current;
        self.currentTime = currentTime;
    }
    return self;
}



#pragma mark - NSCoding

- (void)encodeWithCoder:(NSCoder *)coder {
    [coder encodeObject:self.I0 forKey:@"I0"];
    [coder encodeObject:self.I1 forKey:@"I1"];
    [coder encodeObject:self.I2 forKey:@"I2"];
    [coder encodeObject:self.I3 forKey:@"I3"];
    [coder encodeObject:self.I4 forKey:@"I4"];
    [coder encodeInt:self.bgCurrent forKey:@"bgCurrent"];
    [coder encodeObject:self.k forKey:@"k"];
    [coder encodeObject:self.rf forKey:@"rf"];
    [coder encodeObject:self.current forKey:@"current"];
    [coder encodeObject:self.currentTime forKey:@"currentTime"];
    [coder encodeObject:self.bg forKey:@"bg"];
    [coder encodeObject:self.rfTime forKey:@"rfTime"];
}

- (nullable instancetype)initWithCoder:(NSCoder *)coder {
    self = [super init];
    if (self) {
        self.I0 = [coder decodeObjectForKey:@"I0"];
        self.I1 = [coder decodeObjectForKey:@"I1"];
        self.I2 = [coder decodeObjectForKey:@"I2"];
        self.I3 = [coder decodeObjectForKey:@"I3"];
        self.I4 = [coder decodeObjectForKey:@"I4"];
        self.bgCurrent = [coder decodeIntForKey:@"bgCurrent"];
        self.k = [coder decodeObjectForKey:@"k"];
        self.rf = [coder decodeObjectForKey:@"rf"];
        self.current = [coder decodeObjectForKey:@"current"];
        self.currentTime = [coder decodeObjectForKey:@"currentTime"];
        self.bg = [coder decodeObjectForKey:@"bg"];
        self.rfTime = [coder decodeObjectForKey:@"rfTime"];
    }
    return self;
}

@end
