// // ItemModel.m // kneet // // Created by Jason Lee on 4/1/15. // Copyright (c) 2015 ntels. All rights reserved. // #import "ItemModel.h" #import "JDObject.h" @implementation CmdClsValueModel //- (NSString *)cmdclsValueMsg { // ItemSubModel *subItem = [[ItemSubModel alloc] init]; // subItem.cmdclsValue = _cmdclsValue; // subItem.cmdclsValueMsg = _cmdclsValueMsg; // // return subItem.cmdclsValueMsg; //} @end @implementation ItemSubModel + (JSONKeyMapper *)keyMapper { return [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase]; } - (NSString *)localStringOfDay:(NSString *)day { NSString *lstr = nil; if ([day isEqualToString:ksDayOfWeekMON]) { lstr = NSLocalizedString(@"월", @"월"); } else if ([day isEqualToString:ksDayOfWeekTUE]) { lstr = NSLocalizedString(@"화", @"화"); } else if ([day isEqualToString:ksDayOfWeekWED]) { lstr = NSLocalizedString(@"수", @"수"); } else if ([day isEqualToString:ksDayOfWeekTHU]) { lstr = NSLocalizedString(@"목", @"목"); } else if ([day isEqualToString:ksDayOfWeekFRI]) { lstr = NSLocalizedString(@"금", @"금"); } else if ([day isEqualToString:ksDayOfWeekSAT]) { lstr = NSLocalizedString(@"토", @"토"); } else if ([day isEqualToString:ksDayOfWeekSUN]) { lstr = NSLocalizedString(@"일", @"일"); } return lstr; } - (NSString *)dayOfWeek { if (_dayofweek) { return _dayofweek; } NSMutableString *days = [[NSMutableString alloc] init]; if (_cmdclsValue && ![_cmdclsValue isEmptyString]) { NSArray *darray = [_cmdclsValue componentsSeparatedByString:@","]; for (NSString *day in darray) { NSString *prefix = [days isEmptyString] ? ksEmptyString : @", "; [days appendFormat:@"%@%@", prefix, [self localStringOfDay:day]]; } } return days; } //- (NSString *)cmdclsValueMsg { //// if (!_cmdclsValueMsg || [_cmdclsValueMsg isEmptyString]) { // if (_dueDate && ![_dueDate isEmptyString]) { // _cmdclsValueMsg = _dueDate; // } else if (_daysOfWeek && ![_daysOfWeek isEmptyString]) { // _cmdclsValueMsg = _daysOfWeek; // } else if (_dueTime && ![_dueTime isEmptyString]) { // _cmdclsValueMsg = _dueTime; // } else if (_homeModes && ![_homeModes isEmptyString]) { // _cmdclsValueMsg = _homeModes; // } else if (_externHeat && ![_externHeat isEmptyString]) { // _cmdclsValueMsg = _externHeat; // } //// } // return _cmdclsValueMsg; // //// if (_dueDate && ![_dueDate isEmptyString]) { //// self.cmdclsValueMsg = _dueDate; //// //// } else if (_daysOfWeek && ![_daysOfWeek isEmptyString]) { //// self.cmdclsValueMsg = _daysOfWeek; //// //// } else if (_dueTime && ![_dueTime isEmptyString]) { //// self.cmdclsValueMsg = _dueTime; //// //// } else if (_homeModes && ![_homeModes isEmptyString]) { //// self.cmdclsValueMsg = _homeModes; //// //// } else if (_externHeat && ![_externHeat isEmptyString]) { //// self.cmdclsValueMsg = _externHeat; //// //// } //} + (CmdClsType)cmdclsTypeForCode:(NSString *)code { CmdClsType type = -1; if ([code isEqualToString:ksCmdClassTypeFirmwareVersion]) { type = CmdClsTypeFirmwareVersion; } else if ([code isEqualToString:ksCmdClassTypeSwitchBinary]) { type = CmdClsTypeSwitchBinary; } else if ([code isEqualToString:ksCmdClassTypeSwitchMultiLevel]) { type = CmdClsTypeSwitchMultiLevel; } else if ([code isEqualToString:ksCmdClassTypeSwitchColor]) { type = CmdClsTypeSwitchColor; } else if ([code isEqualToString:ksCmdClassTypeSensorBinary]) { type = CmdClsTypeSensorBinary; } else if ([code isEqualToString:ksCmdClassTypeSensorMultiLevel]) { type = CmdClsTypeSensorMultiLevel; } else if ([code isEqualToString:ksCmdClassTypeThermostatMode]) { type = CmdClsTypeThermostatMode; } else if ([code isEqualToString:ksCmdClassTypeThermostatFanMode]) { type = CmdClsTypeThermostatFanMode; } else if ([code isEqualToString:ksCmdClassTypeThermostatSetPoint]) { type = CmdClsTypeThermostatSetPoint; } else if ([code isEqualToString:ksCmdClassTypeLock]) { type = CmdClsTypeLock; } else if ([code isEqualToString:ksCmdClassTypeMeterCurrent]) { type = CmdClsTypeMeterCurrent; } else if ([code isEqualToString:ksCmdClassTypeMeterTotal]) { type = CmdClsTypeMeterTotal; } else if ([code isEqualToString:ksCmdClassTypeAVControlPlayback]) { type = CmdClsTypeAVControlPlayback; } else if ([code isEqualToString:ksCmdClassTypeHomeMode]) { type = CmdClsTypeHomeMode; } else if ([code isEqualToString:ksCmdClassTypeSpeedControl]) { type = CmdClsTypeSpeedControl; } else if ([code isEqualToString:ksCmdClassTypeValve]) { type = CmdClsTypeValve; } else if ([code isEqualToString:ksCmdClassTypeBattery]) { type = CmdClsTypeBattery; } else if ([code isEqualToString:ksCmdClassTypeDeviceStatus]) { type = CmdClsTypeDeviceStatus; } else if ([code isEqualToString:ksCmdClassTypePresence]) { type = CmdClsTypePresence; } else if ([code isEqualToString:ksCmdClassTypeSystem]) { type = CmdClsTypeSystem; } else if ([code isEqualToString:ksCmdClassTypeMeter]) { type = CmdClsTypeMeter; } return type; } - (CmdClsType)cmdclsType { return [ItemSubModel cmdclsTypeForCode:_cmdclsCode]; } - (NSInteger)cmdclsValueMsgLength { NSInteger length = 0; // NSArray *array = nil; // // switch ([self cmdclsType]) { // case CmdClsTypeLock: // array = [self cmdclsValueListOfLock]; // break; // default: // break; // } for (CmdClsValueModel *tmpCmdclsValue in self.cmdclsValueList) { if (tmpCmdclsValue.cmdclsValueMsg.length > length) { length = tmpCmdclsValue.cmdclsValueMsg.length; } } return length; } - (NSString *)cmdclsValueMsgLongest { NSString *hstring = nil; // NSArray *array = nil; // // switch ([self cmdclsType]) { // case CmdClsTypeSwitchBinary: // array = [self cmdclsValueListOfSwitchBinary]; // break; // case CmdClsTypeLock: // array = [self cmdclsValueListOfLock]; // break; // default: // break; // } NSUInteger highest = 0; for (CmdClsValueModel *tmpCmdclsValue in self.cmdclsValueList) { if (tmpCmdclsValue.cmdclsValueMsg.length > highest) { highest = tmpCmdclsValue.cmdclsValueMsg.length; hstring = tmpCmdclsValue.cmdclsValueMsg; } } return hstring; } /* - (NSArray *)cmdclsValueList { switch ([self cmdclsType]) { case CmdClsTypeThermostatMode: _cmdclsValueList = [self cmdclsValueListOfThermostatMode]; break; case CmdClsTypeLock: _cmdclsValueList = [self cmdclsValueListOfLock]; break; case CmdClsTypeSpeedControl: _cmdclsValueList = [self cmdclsValueListOfSpeedControl]; break; case CmdClsTypeSwitchBinary: _cmdclsValueList = [self cmdclsValueListOfSwitchBinary]; break; case CmdClsTypeValve: _cmdclsValueList = [self cmdclsValueListOfValve]; break; default: break; } return _cmdclsValueList; } - (NSArray *)cmdclsValueListOfThermostatMode { NSMutableArray *array = [(NSMutableArray *)[NSMutableArray alloc] init]; NSInteger typeId = [_cmdclsTypeId integerValue]; switch (typeId) { case 13001: { [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OFF", @"cmdcls_value_msg": NSLocalizedString(@"꺼짐", @"꺼짐")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"COOL", @"cmdcls_value_msg": NSLocalizedString(@"냉방", @"냉방")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"HEAT", @"cmdcls_value_msg": NSLocalizedString(@"난방", @"난방")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"AUTO", @"cmdcls_value_msg": NSLocalizedString(@"자동", @"자동")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"FAN_ONLY", @"cmdcls_value_msg": NSLocalizedString(@"환기", @"환기")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"DRY_AIR", @"cmdcls_value_msg": NSLocalizedString(@"제습", @"제습")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"AWAY", @"cmdcls_value_msg": NSLocalizedString(@"외출", @"외출")} error:nil]]; } break; case 13002: { [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OFF", @"cmdcls_value_msg": NSLocalizedString(@"꺼짐", @"꺼짐")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"COOL", @"cmdcls_value_msg": NSLocalizedString(@"냉방", @"냉방")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"HEAT", @"cmdcls_value_msg": NSLocalizedString(@"난방", @"난방")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"AUTO", @"cmdcls_value_msg": NSLocalizedString(@"자동", @"자동")} error:nil]]; } break; case 13003: { [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OFF", @"cmdcls_value_msg": NSLocalizedString(@"꺼짐", @"꺼짐")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"HEAT", @"cmdcls_value_msg": NSLocalizedString(@"난방", @"난방")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"AWAY", @"cmdcls_value_msg": NSLocalizedString(@"외출", @"외출")} error:nil]]; } break; case 13004: { [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OFF", @"cmdcls_value_msg": NSLocalizedString(@"꺼짐", @"꺼짐")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"COOL", @"cmdcls_value_msg": NSLocalizedString(@"냉방", @"냉방")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"FAN_ONLY", @"cmdcls_value_msg": NSLocalizedString(@"환기", @"환기")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"DRY_AIR", @"cmdcls_value_msg": NSLocalizedString(@"제습", @"제습")} error:nil]]; } break; } return array; } - (NSArray *)cmdclsValueListOfSwitchBinary { NSMutableArray *array = [(NSMutableArray *)[NSMutableArray alloc] init]; NSInteger typeId = [_cmdclsTypeId integerValue]; switch (typeId) { case 17001: case 17002: case 17003: case 17004: case 17005: { for (CmdClsValueModel *cmdclsValue in self.cmdclsValueList) { if ([cmdclsValue.cmdclsValue isEqualToString:@"ON"]) { cmdclsValue.localizedCmdClsValueMsg = @"켬", @"" } } [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"ON", @"cmdcls_value_msg": NSLocalizedString(@"켬", @"켬")} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OFF", @"cmdcls_value_msg": NSLocalizedString(@"끔", @"끔")} error:nil]]; break; } } return array; } - (NSArray *)cmdclsValueListOfLock { NSMutableArray *array = [(NSMutableArray *)[NSMutableArray alloc] init]; NSInteger typeId = [_cmdclsTypeId integerValue]; switch (typeId) { case 14001: { [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"LOCKED", @"cmdcls_value_msg": @"잠김"} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"UNCLOCKED", @"cmdcls_value_msg": @"열림"} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"JAMMED", @"cmdcls_value_msg": @"걸림"} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"FORCED_OPEN", @"cmdcls_value_msg": @"수동"} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"UNSPECIFIED", @"cmdcls_value_msg": @"오류"} error:nil]]; } break; case 14002: case 14003: [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"LOCKED", @"cmdcls_value_msg": @"잠김"} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"UNCLOCKED", @"cmdcls_value_msg": @"열림"} error:nil]]; break; } return array; } - (NSArray *)cmdclsValueListOfSpeedControl { NSMutableArray *array = [(NSMutableArray *)[NSMutableArray alloc] init]; NSInteger typeId = [_cmdclsTypeId integerValue]; switch (typeId) { case 20001: { [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OFF", @"cmdcls_value_msg": @"꺼짐"} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"LOW", @"cmdcls_value_msg": @"약"} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"MEDIUM", @"cmdcls_value_msg": @"중"} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"HIGH", @"cmdcls_value_msg": @"강"} error:nil]]; } break; } return array; } - (NSArray *)cmdclsValueListOfValve { NSMutableArray *array = [(NSMutableArray *)[NSMutableArray alloc] init]; NSInteger typeId = [_cmdclsTypeId integerValue]; switch (typeId) { case 36001: case 36002: case 36003: { [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OPEN", @"cmdcls_value_msg": @"열기"} error:nil]]; [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"CLOSE", @"cmdcls_value_msg": @"잠그기"} error:nil]]; } break; } return array; } */ - (NSString *)unit { if ([_unit isEqualToString:@"\\"]) { _unit = @"₩"; } return _unit; } //- (NSString *)cmdclsValueMsgOfSensorBinary { // NSInteger typeId = [_cmdclsTypeId integerValue]; // NSString *msg = ksEmptyString; // switch (typeId) { // case 11001: // case 11002: // case 11003: // case 11004: // case 11005: // case 11006: // case 11007: // case 11008: // case 11009: // case 11010: // case 11012: // case 11013: // case 11014: // case 11016: // if ([_cmdclsValue isEqualToString:@"TRUE"]) { // msg = NSLocalizedString(@"감지됨", @"감지됨"); // } else if ([_cmdclsValue isEqualToString:@"FALSE"]) { // msg = NSLocalizedString(@"정상", @"정상"); // } else { // msg = @"-"; // } // break; // case 11011: // if ([_cmdclsValue isEqualToString:@"TRUE"]) { // msg = NSLocalizedString(@"열림", @"열림"); // } else if ([_cmdclsValue isEqualToString:@"FALSE"]) { // msg = NSLocalizedString(@"닫힘", @"닫힘"); // } else { // msg = @"-"; // } // case 11015: // if ([_cmdclsValue isEqualToString:@"TRUE"]) { // msg = NSLocalizedString(@"들어옴", @"들어옴"); // } else if ([_cmdclsValue isEqualToString:@"FALSE"]) { // msg = NSLocalizedString(@"나감", @"나감"); // } else { // msg = @"-"; // } // break; // } // return msg; //} - (NSString *)cmdclsValueMsgOfThermostatMode { NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 13001: case 13002: case 13003: case 13004: if ([_cmdclsValue isEqualToString:@"OFF"]) { msg = NSLocalizedString(@"꺼짐", @"꺼짐"); } else if ([_cmdclsValue isEqualToString:@"COOL"]) { msg = NSLocalizedString(@"냉방", @"냉방"); } else if ([_cmdclsValue isEqualToString:@"HEAT"]) { msg = NSLocalizedString(@"난방", @"난방"); } else if ([_cmdclsValue isEqualToString:@"AUTO"]) { msg = NSLocalizedString(@"자동", @"자동"); } else if ([_cmdclsValue isEqualToString:@"FAN_ONLY"]) { msg = NSLocalizedString(@"환기", @"환기"); } else if ([_cmdclsValue isEqualToString:@"DRY_AIR"]) { msg = NSLocalizedString(@"제습", @"제습"); } else if ([_cmdclsValue isEqualToString:@"AWAY"]) { msg = NSLocalizedString(@"외출", @"외출"); } else { msg = @"-"; } break; } return msg; } - (NSString *)cmdclsValueMsgOfLock { NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 14001: if ([_cmdclsValue isEqualToString:@"LOCKED"]) { msg = NSLocalizedString(@"잠김", @"잠김"); } else if ([_cmdclsValue isEqualToString:@"UNLOCKED"]) { msg = NSLocalizedString(@"열림", @"열림"); } else if ([_cmdclsValue isEqualToString:@"JAMMED"]) { msg = NSLocalizedString(@"걸림", @"걸림"); } else if ([_cmdclsValue isEqualToString:@"FORCED_OPEN"]) { msg = NSLocalizedString(@"수동", @"수동"); } else if ([_cmdclsValue isEqualToString:@"UNSPECIFIED"]) { msg = NSLocalizedString(@"오류", @"오류"); } else { msg = @"-"; } break; case 14002: case 14003: if ([_cmdclsValue isEqualToString:@"LOCKED"]) { msg = @"잠김"; } else if ([_cmdclsValue isEqualToString:@"UNLOCKED"]) { msg = @"열림"; } else { msg = @"-"; } break; } return msg; } - (NSString *)cmdclsValueMsgOfSwitchBinary {//On/Off status NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 17001://Default case 17002://Plug case 17003://Bulb case 17004://Light case 17005://Wall Switch if ([_cmdclsValue isEqualToString:@"ON"]) { msg = NSLocalizedString(@"켬", @"켬"); } else if ([_cmdclsValue isEqualToString:@"OFF"]) { msg = NSLocalizedString(@"끔", @"끔"); } else { msg = @"-"; } break; } return msg; } - (NSString *)cmdclsValueMsgOfValve {//Openn/Close status NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 36001://Default case 36002://NTELS_1 case 36003://NTELS_2 if ([_cmdclsValue isEqualToString:@"OPEN"]) { msg = NSLocalizedString(@"열기", @"열기"); } else if ([_cmdclsValue isEqualToString:@"CLOSE"]) { msg = NSLocalizedString(@"잠그기", @"잠그기"); } else { msg = @"-"; } break; } return msg; } - (NSString *)cmdclsValueMsg { switch ([self cmdclsType]) { // case CmdClsTypeSensorBinary: // _cmdclsValueMsg = [self cmdclsValueMsgOfSensorBinary]; // break; case CmdClsTypeThermostatMode: _cmdclsValueMsg = [self cmdclsValueMsgOfThermostatMode]; break; case CmdClsTypeLock: _cmdclsValueMsg = [self cmdclsValueMsgOfLock]; break; case CmdClsTypeSwitchBinary: _cmdclsValueMsg = [self cmdclsValueMsgOfSwitchBinary]; break; case CmdClsTypeSpeedControl: _cmdclsValueMsg = [self cmdclsValueMsgOfSpeedControl]; break; case CmdClsTypeAVControlPlayback: _cmdclsValueMsg = [self cmdclsValueMsgOfAVPlayback]; break; case CmdClsTypeValve: _cmdclsValueMsg = [self cmdclsValueMsgOfValve]; break; case CmdClsTypeSensorMultiLevel: case CmdClsTypeBattery: case CmdClsTypeSensorBinary: case CmdClsTypeMeter: { NSString *condition = [_conditionTypeCode isEqualToString:ksConditionTypeCodeGreatOrEqual] ? @"이상" : @"이하"; _cmdclsValueMsg = [NSString stringWithFormat:@"%@%@ %@", _cmdclsValue, _unit, condition]; } } return _cmdclsValueMsg; } - (NSString *)cmdclsValueMsgOfSpeedControl { NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 20001: if ([_cmdclsValue isEqualToString:@"OFF"]) { msg = NSLocalizedString(@"꺼짐", @"꺼짐"); } else if ([_cmdclsValue isEqualToString:@"LOW"]) { msg = NSLocalizedString(@"약", @"약"); } else if ([_cmdclsValue isEqualToString:@"MEDIUM"]) { msg = NSLocalizedString(@"중", @"중"); } else if ([_cmdclsValue isEqualToString:@"HIGH"]) { msg = NSLocalizedString(@"강", @"강"); } else { msg = @"-"; } break; } return msg; } - (NSString *)cmdclsValueMsgOfAVPlayback { NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 21001: if ([_cmdclsValue isEqualToString:@"PLAYING"]) { msg = NSLocalizedString(@"재생 중", @"재생 중"); } else if ([_cmdclsValue isEqualToString:@"PAUSED"]) { msg = NSLocalizedString(@"정지 됨", @"정지 됨"); } else { msg = @"-"; } break; } return msg; } - (BOOL)isOnline { return _onlineState && ![_onlineState isEmptyString] && [_onlineState isEqualToString:@"ON"]; } - (NSString *)conditionTypeCode { if (!_conditionTypeCode) { switch ([self cmdclsType]) { case CmdClsTypeSwitchMultiLevel: case CmdClsTypeSensorMultiLevel: case CmdClsTypeBattery: case CmdClsTypeMeter: _conditionTypeCode = @"05"; break; default: _conditionTypeCode = @"01"; break; } } return _conditionTypeCode; } @end @implementation ItemModel + (JSONKeyMapper *)keyMapper { return [[JSONKeyMapper alloc] initWithDictionary:@{@"pred_item_sequence": @"predItemSequence", @"item_type_code": @"itemTypeCode", @"item_sub_type_code": @"itemSubTypeCode", @"item_name": @"itemName", @"item_sub": @"subItems", @"pred_action_sequence": @"predActionSequence", @"pred_scene_id": @"predSceneId", @"pred_rule_id": @"predRuleId", @"cnt" : @"cnt", @"total_cnt" : @"totalCnt", @"image_file_name": @"imageFileName", @"source_id": @"sourceId", @"source_name": @"sourceName", @"image_file_view_name": @"imageFileViewName"}]; } + (NSString *)itemSubTypeString:(NSString *)itemSubTypeCode { NSString *string = ksEmptyString; if ([itemSubTypeCode isEqualToString:ksItemSubTypeCodeDevice]) { string = @"Choose your things & action"; } else if ([itemSubTypeCode isEqualToString:ksItemSubTypeCodeMode]) { string = @"Choose home mode"; } else if ([itemSubTypeCode isEqualToString:ksItemSubTypeCodeAppPush]) { string = @"Choose your things & action"; } else if ([itemSubTypeCode isEqualToString:ksItemSubTypeCodeTimer]) { string = @"Choose your things & action"; } return string; } - (NSInteger)sumPredDeviceCount { return _predDevices.count + [_cnt integerValue]; } - (NSInteger)sumModesCount { return _modes.count + [_cnt integerValue]; } - (NSInteger)sumPushesCount { return _pushes.count + [_cnt integerValue]; } @end @implementation ItemListModel @end @implementation ItemSubListModel @end