//
//  GMEditQuesPartModel.m
//  Gengmei
//
//  Created by Locus on 2020/2/19.
//  Copyright © 2020 更美互动信息科技有限公司. All rights reserved.
//

#import "GMEditQuesPartModel.h"
#import "GMLibraryHeader.h"

@implementation GMEditQuesPartDetailModel

@end

@implementation GMEditQuesPartModel

- (NSString<Ignore> *)improveAppealNamesStr {
    _improveAppealNamesStr = @"";
    [self.improveAppeals enumerateObjectsUsingBlock:^(GMEditQuesPartDetailModel *obj, NSUInteger idx, BOOL * _Nonnull stop) {
        _improveAppealNamesStr = [_improveAppealNamesStr stringByAppendingFormat:@"%@%@", (idx == 0 ? @"" : @","), obj.name];
    }];
    return _improveAppealNamesStr;
}

- (NSString<Ignore> *)suitProjectNamesStr {
    _suitProjectNamesStr = @"";
    [self.suitProjects enumerateObjectsUsingBlock:^(GMEditQuesPartDetailModel *obj, NSUInteger idx, BOOL * _Nonnull stop) {
        _suitProjectNamesStr = [_suitProjectNamesStr stringByAppendingFormat:@"%@%@", (idx == 0 ? @"" : @","), obj.name];
    }];
    return _suitProjectNamesStr;
}

- (NSString<Ignore> *)improveAppealIdsStr {
    NSMutableArray *ids = [NSMutableArray new];
    [self.improveAppeals enumerateObjectsUsingBlock:^(GMEditQuesPartDetailModel *obj, NSUInteger idx, BOOL * _Nonnull stop) {
        [ids addObject:@(obj.id)];
    }];
    return [NSString convertToBriefJsonString:ids];
}

- (NSString<Ignore> *)suitProjectIdsStr {
    NSMutableArray *ids = [NSMutableArray new];
    [self.suitProjects enumerateObjectsUsingBlock:^(GMEditQuesPartDetailModel *obj, NSUInteger idx, BOOL * _Nonnull stop) {
        [ids addObject:@(obj.id)];
    }];
    return [NSString convertToBriefJsonString:ids];
}

- (id)copyWithZone:(NSZone *)zone {
    NSDictionary *dict = [self toDictionary];
    return [[GMEditQuesPartModel alloc] initWithDictionary:dict error:nil];
}

@end
