// This file was automatically generated by protocompiler
// DO NOT EDIT!
// Compiled from C2Metric.proto

#import "SECC2MPCloudKitInfo.h"
#import <ProtocolBuffer/PBConstants.h>
#import <ProtocolBuffer/PBHashUtil.h>
#import <ProtocolBuffer/PBDataReader.h>

#import "SECC2MPCloudKitOperationGroupInfo.h"
#import "SECC2MPCloudKitOperationInfo.h"

#if !__has_feature(objc_arc)
# error This generated file depends on ARC but it is not enabled; turn on ARC, or use 'objc_use_arc' option to generate non-ARC code.
#endif

@implementation SECC2MPCloudKitInfo

- (BOOL)hasClientProcessVersion
{
    return _clientProcessVersion != nil;
}
@synthesize clientProcessVersion = _clientProcessVersion;
- (BOOL)hasClientBundleId
{
    return _clientBundleId != nil;
}
@synthesize clientBundleId = _clientBundleId;
- (BOOL)hasContainer
{
    return _container != nil;
}
@synthesize container = _container;
- (BOOL)hasEnvironment
{
    return _environment != nil;
}
@synthesize environment = _environment;
@synthesize anonymous = _anonymous;
- (void)setAnonymous:(BOOL)v
{
    _has.anonymous = YES;
    _anonymous = v;
}
- (void)setHasAnonymous:(BOOL)f
{
    _has.anonymous = f;
}
- (BOOL)hasAnonymous
{
    return _has.anonymous;
}
@synthesize operationGroups = _operationGroups;
- (void)clearOperationGroups
{
    [_operationGroups removeAllObjects];
}
- (void)addOperationGroup:(SECC2MPCloudKitOperationGroupInfo *)i
{
    if (!_operationGroups)
    {
        _operationGroups = [[NSMutableArray alloc] init];
    }
    [_operationGroups addObject:i];
}
- (NSUInteger)operationGroupsCount
{
    return [_operationGroups count];
}
- (SECC2MPCloudKitOperationGroupInfo *)operationGroupAtIndex:(NSUInteger)idx
{
    return [_operationGroups objectAtIndex:idx];
}
+ (Class)operationGroupType
{
    return [SECC2MPCloudKitOperationGroupInfo class];
}
@synthesize reportOperationGroupFrequency = _reportOperationGroupFrequency;
- (void)setReportOperationGroupFrequency:(uint64_t)v
{
    _has.reportOperationGroupFrequency = YES;
    _reportOperationGroupFrequency = v;
}
- (void)setHasReportOperationGroupFrequency:(BOOL)f
{
    _has.reportOperationGroupFrequency = f;
}
- (BOOL)hasReportOperationGroupFrequency
{
    return _has.reportOperationGroupFrequency;
}
@synthesize reportOperationGroupFrequencyBase = _reportOperationGroupFrequencyBase;
- (void)setReportOperationGroupFrequencyBase:(uint64_t)v
{
    _has.reportOperationGroupFrequencyBase = YES;
    _reportOperationGroupFrequencyBase = v;
}
- (void)setHasReportOperationGroupFrequencyBase:(BOOL)f
{
    _has.reportOperationGroupFrequencyBase = f;
}
- (BOOL)hasReportOperationGroupFrequencyBase
{
    return _has.reportOperationGroupFrequencyBase;
}
@synthesize clientOperations = _clientOperations;
- (void)clearClientOperations
{
    [_clientOperations removeAllObjects];
}
- (void)addClientOperation:(SECC2MPCloudKitOperationInfo *)i
{
    if (!_clientOperations)
    {
        _clientOperations = [[NSMutableArray alloc] init];
    }
    [_clientOperations addObject:i];
}
- (NSUInteger)clientOperationsCount
{
    return [_clientOperations count];
}
- (SECC2MPCloudKitOperationInfo *)clientOperationAtIndex:(NSUInteger)idx
{
    return [_clientOperations objectAtIndex:idx];
}
+ (Class)clientOperationType
{
    return [SECC2MPCloudKitOperationInfo class];
}
@synthesize reportClientOperationFrequency = _reportClientOperationFrequency;
- (void)setReportClientOperationFrequency:(uint64_t)v
{
    _has.reportClientOperationFrequency = YES;
    _reportClientOperationFrequency = v;
}
- (void)setHasReportClientOperationFrequency:(BOOL)f
{
    _has.reportClientOperationFrequency = f;
}
- (BOOL)hasReportClientOperationFrequency
{
    return _has.reportClientOperationFrequency;
}
@synthesize reportClientOperationFrequencyBase = _reportClientOperationFrequencyBase;
- (void)setReportClientOperationFrequencyBase:(uint64_t)v
{
    _has.reportClientOperationFrequencyBase = YES;
    _reportClientOperationFrequencyBase = v;
}
- (void)setHasReportClientOperationFrequencyBase:(BOOL)f
{
    _has.reportClientOperationFrequencyBase = f;
}
- (BOOL)hasReportClientOperationFrequencyBase
{
    return _has.reportClientOperationFrequencyBase;
}

- (NSString *)description
{
    return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
}

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    if (self->_clientProcessVersion)
    {
        [dict setObject:self->_clientProcessVersion forKey:@"client_process_version"];
    }
    if (self->_clientBundleId)
    {
        [dict setObject:self->_clientBundleId forKey:@"client_bundle_id"];
    }
    if (self->_container)
    {
        [dict setObject:self->_container forKey:@"container"];
    }
    if (self->_environment)
    {
        [dict setObject:self->_environment forKey:@"environment"];
    }
    if (self->_has.anonymous)
    {
        [dict setObject:[NSNumber numberWithBool:self->_anonymous] forKey:@"anonymous"];
    }
    if ([self->_operationGroups count])
    {
        NSMutableArray *operationGroupsDictReprs = [[NSMutableArray alloc] initWithCapacity:[self->_operationGroups count]];
        for (SECC2MPCloudKitOperationGroupInfo *i_operationGroup in self->_operationGroups)
        {
            [operationGroupsDictReprs addObject:[i_operationGroup dictionaryRepresentation]];
        }
        [dict setObject:operationGroupsDictReprs forKey:@"operation_group"];
    }
    if (self->_has.reportOperationGroupFrequency)
    {
        [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_reportOperationGroupFrequency] forKey:@"report_operation_group_frequency"];
    }
    if (self->_has.reportOperationGroupFrequencyBase)
    {
        [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_reportOperationGroupFrequencyBase] forKey:@"report_operation_group_frequency_base"];
    }
    if ([self->_clientOperations count])
    {
        NSMutableArray *clientOperationsDictReprs = [[NSMutableArray alloc] initWithCapacity:[self->_clientOperations count]];
        for (SECC2MPCloudKitOperationInfo *i_clientOperation in self->_clientOperations)
        {
            [clientOperationsDictReprs addObject:[i_clientOperation dictionaryRepresentation]];
        }
        [dict setObject:clientOperationsDictReprs forKey:@"client_operation"];
    }
    if (self->_has.reportClientOperationFrequency)
    {
        [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_reportClientOperationFrequency] forKey:@"report_client_operation_frequency"];
    }
    if (self->_has.reportClientOperationFrequencyBase)
    {
        [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_reportClientOperationFrequencyBase] forKey:@"report_client_operation_frequency_base"];
    }
    return dict;
}

BOOL SECC2MPCloudKitInfoReadFrom(__unsafe_unretained SECC2MPCloudKitInfo *self, __unsafe_unretained PBDataReader *reader) {
    while (PBReaderHasMoreData(reader)) {
        uint32_t tag = 0;
        uint8_t aType = 0;

        PBReaderReadTag32AndType(reader, &tag, &aType);

        if (PBReaderHasError(reader))
            break;

        if (aType == TYPE_END_GROUP) {
            break;
        }

        switch (tag) {

            case 102 /* clientProcessVersion */:
            {
                NSString *new_clientProcessVersion = PBReaderReadString(reader);
                self->_clientProcessVersion = new_clientProcessVersion;
            }
            break;
            case 103 /* clientBundleId */:
            {
                NSString *new_clientBundleId = PBReaderReadString(reader);
                self->_clientBundleId = new_clientBundleId;
            }
            break;
            case 201 /* container */:
            {
                NSString *new_container = PBReaderReadString(reader);
                self->_container = new_container;
            }
            break;
            case 202 /* environment */:
            {
                NSString *new_environment = PBReaderReadString(reader);
                self->_environment = new_environment;
            }
            break;
            case 203 /* anonymous */:
            {
                self->_has.anonymous = YES;
                self->_anonymous = PBReaderReadBOOL(reader);
            }
            break;
            case 301 /* operationGroups */:
            {
                SECC2MPCloudKitOperationGroupInfo *new_operationGroup = [[SECC2MPCloudKitOperationGroupInfo alloc] init];
                [self addOperationGroup:new_operationGroup];
                PBDataReaderMark mark_operationGroup;
                BOOL markError = !PBReaderPlaceMark(reader, &mark_operationGroup);
                if (markError)
                {
                    return NO;
                }
                BOOL inError = !SECC2MPCloudKitOperationGroupInfoReadFrom(new_operationGroup, reader);
                if (inError)
                {
                    return NO;
                }
                PBReaderRecallMark(reader, &mark_operationGroup);
            }
            break;
            case 302 /* reportOperationGroupFrequency */:
            {
                self->_has.reportOperationGroupFrequency = YES;
                self->_reportOperationGroupFrequency = PBReaderReadUint64(reader);
            }
            break;
            case 303 /* reportOperationGroupFrequencyBase */:
            {
                self->_has.reportOperationGroupFrequencyBase = YES;
                self->_reportOperationGroupFrequencyBase = PBReaderReadUint64(reader);
            }
            break;
            case 401 /* clientOperations */:
            {
                SECC2MPCloudKitOperationInfo *new_clientOperation = [[SECC2MPCloudKitOperationInfo alloc] init];
                [self addClientOperation:new_clientOperation];
                PBDataReaderMark mark_clientOperation;
                BOOL markError = !PBReaderPlaceMark(reader, &mark_clientOperation);
                if (markError)
                {
                    return NO;
                }
                BOOL inError = !SECC2MPCloudKitOperationInfoReadFrom(new_clientOperation, reader);
                if (inError)
                {
                    return NO;
                }
                PBReaderRecallMark(reader, &mark_clientOperation);
            }
            break;
            case 402 /* reportClientOperationFrequency */:
            {
                self->_has.reportClientOperationFrequency = YES;
                self->_reportClientOperationFrequency = PBReaderReadUint64(reader);
            }
            break;
            case 403 /* reportClientOperationFrequencyBase */:
            {
                self->_has.reportClientOperationFrequencyBase = YES;
                self->_reportClientOperationFrequencyBase = PBReaderReadUint64(reader);
            }
            break;
            default:
                if (!PBReaderSkipValueWithTag(reader, tag, aType))
                    return NO;
                break;
        }
    }
    return !PBReaderHasError(reader);
}

- (BOOL)readFrom:(PBDataReader *)reader
{
    return SECC2MPCloudKitInfoReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
    /* clientProcessVersion */
    {
        if (self->_clientProcessVersion)
        {
            PBDataWriterWriteStringField(writer, self->_clientProcessVersion, 102);
        }
    }
    /* clientBundleId */
    {
        if (self->_clientBundleId)
        {
            PBDataWriterWriteStringField(writer, self->_clientBundleId, 103);
        }
    }
    /* container */
    {
        if (self->_container)
        {
            PBDataWriterWriteStringField(writer, self->_container, 201);
        }
    }
    /* environment */
    {
        if (self->_environment)
        {
            PBDataWriterWriteStringField(writer, self->_environment, 202);
        }
    }
    /* anonymous */
    {
        if (self->_has.anonymous)
        {
            PBDataWriterWriteBOOLField(writer, self->_anonymous, 203);
        }
    }
    /* operationGroups */
    {
        for (SECC2MPCloudKitOperationGroupInfo *i_operationGroup in self->_operationGroups)
        {
            PBDataWriterWriteSubmessage(writer, i_operationGroup, 301);
        }
    }
    /* reportOperationGroupFrequency */
    {
        if (self->_has.reportOperationGroupFrequency)
        {
            PBDataWriterWriteUint64Field(writer, self->_reportOperationGroupFrequency, 302);
        }
    }
    /* reportOperationGroupFrequencyBase */
    {
        if (self->_has.reportOperationGroupFrequencyBase)
        {
            PBDataWriterWriteUint64Field(writer, self->_reportOperationGroupFrequencyBase, 303);
        }
    }
    /* clientOperations */
    {
        for (SECC2MPCloudKitOperationInfo *i_clientOperation in self->_clientOperations)
        {
            PBDataWriterWriteSubmessage(writer, i_clientOperation, 401);
        }
    }
    /* reportClientOperationFrequency */
    {
        if (self->_has.reportClientOperationFrequency)
        {
            PBDataWriterWriteUint64Field(writer, self->_reportClientOperationFrequency, 402);
        }
    }
    /* reportClientOperationFrequencyBase */
    {
        if (self->_has.reportClientOperationFrequencyBase)
        {
            PBDataWriterWriteUint64Field(writer, self->_reportClientOperationFrequencyBase, 403);
        }
    }
}

- (void)copyTo:(SECC2MPCloudKitInfo *)other
{
    if (_clientProcessVersion)
    {
        other.clientProcessVersion = _clientProcessVersion;
    }
    if (_clientBundleId)
    {
        other.clientBundleId = _clientBundleId;
    }
    if (_container)
    {
        other.container = _container;
    }
    if (_environment)
    {
        other.environment = _environment;
    }
    if (self->_has.anonymous)
    {
        other->_anonymous = _anonymous;
        other->_has.anonymous = YES;
    }
    if ([self operationGroupsCount])
    {
        [other clearOperationGroups];
        NSUInteger operationGroupsCnt = [self operationGroupsCount];
        for (NSUInteger i = 0; i < operationGroupsCnt; i++)
        {
            [other addOperationGroup:[self operationGroupAtIndex:i]];
        }
    }
    if (self->_has.reportOperationGroupFrequency)
    {
        other->_reportOperationGroupFrequency = _reportOperationGroupFrequency;
        other->_has.reportOperationGroupFrequency = YES;
    }
    if (self->_has.reportOperationGroupFrequencyBase)
    {
        other->_reportOperationGroupFrequencyBase = _reportOperationGroupFrequencyBase;
        other->_has.reportOperationGroupFrequencyBase = YES;
    }
    if ([self clientOperationsCount])
    {
        [other clearClientOperations];
        NSUInteger clientOperationsCnt = [self clientOperationsCount];
        for (NSUInteger i = 0; i < clientOperationsCnt; i++)
        {
            [other addClientOperation:[self clientOperationAtIndex:i]];
        }
    }
    if (self->_has.reportClientOperationFrequency)
    {
        other->_reportClientOperationFrequency = _reportClientOperationFrequency;
        other->_has.reportClientOperationFrequency = YES;
    }
    if (self->_has.reportClientOperationFrequencyBase)
    {
        other->_reportClientOperationFrequencyBase = _reportClientOperationFrequencyBase;
        other->_has.reportClientOperationFrequencyBase = YES;
    }
}

- (id)copyWithZone:(NSZone *)zone
{
    SECC2MPCloudKitInfo *copy = [[[self class] allocWithZone:zone] init];
    copy->_clientProcessVersion = [_clientProcessVersion copyWithZone:zone];
    copy->_clientBundleId = [_clientBundleId copyWithZone:zone];
    copy->_container = [_container copyWithZone:zone];
    copy->_environment = [_environment copyWithZone:zone];
    if (self->_has.anonymous)
    {
        copy->_anonymous = _anonymous;
        copy->_has.anonymous = YES;
    }
    for (SECC2MPCloudKitOperationGroupInfo *v in _operationGroups)
    {
        SECC2MPCloudKitOperationGroupInfo *vCopy = [v copyWithZone:zone];
        [copy addOperationGroup:vCopy];
    }
    if (self->_has.reportOperationGroupFrequency)
    {
        copy->_reportOperationGroupFrequency = _reportOperationGroupFrequency;
        copy->_has.reportOperationGroupFrequency = YES;
    }
    if (self->_has.reportOperationGroupFrequencyBase)
    {
        copy->_reportOperationGroupFrequencyBase = _reportOperationGroupFrequencyBase;
        copy->_has.reportOperationGroupFrequencyBase = YES;
    }
    for (SECC2MPCloudKitOperationInfo *v in _clientOperations)
    {
        SECC2MPCloudKitOperationInfo *vCopy = [v copyWithZone:zone];
        [copy addClientOperation:vCopy];
    }
    if (self->_has.reportClientOperationFrequency)
    {
        copy->_reportClientOperationFrequency = _reportClientOperationFrequency;
        copy->_has.reportClientOperationFrequency = YES;
    }
    if (self->_has.reportClientOperationFrequencyBase)
    {
        copy->_reportClientOperationFrequencyBase = _reportClientOperationFrequencyBase;
        copy->_has.reportClientOperationFrequencyBase = YES;
    }
    return copy;
}

- (BOOL)isEqual:(id)object
{
    SECC2MPCloudKitInfo *other = (SECC2MPCloudKitInfo *)object;
    return [other isMemberOfClass:[self class]]
    &&
    ((!self->_clientProcessVersion && !other->_clientProcessVersion) || [self->_clientProcessVersion isEqual:other->_clientProcessVersion])
    &&
    ((!self->_clientBundleId && !other->_clientBundleId) || [self->_clientBundleId isEqual:other->_clientBundleId])
    &&
    ((!self->_container && !other->_container) || [self->_container isEqual:other->_container])
    &&
    ((!self->_environment && !other->_environment) || [self->_environment isEqual:other->_environment])
    &&
    ((self->_has.anonymous && other->_has.anonymous && ((self->_anonymous && other->_anonymous) || (!self->_anonymous && !other->_anonymous))) || (!self->_has.anonymous && !other->_has.anonymous))
    &&
    ((!self->_operationGroups && !other->_operationGroups) || [self->_operationGroups isEqual:other->_operationGroups])
    &&
    ((self->_has.reportOperationGroupFrequency && other->_has.reportOperationGroupFrequency && self->_reportOperationGroupFrequency == other->_reportOperationGroupFrequency) || (!self->_has.reportOperationGroupFrequency && !other->_has.reportOperationGroupFrequency))
    &&
    ((self->_has.reportOperationGroupFrequencyBase && other->_has.reportOperationGroupFrequencyBase && self->_reportOperationGroupFrequencyBase == other->_reportOperationGroupFrequencyBase) || (!self->_has.reportOperationGroupFrequencyBase && !other->_has.reportOperationGroupFrequencyBase))
    &&
    ((!self->_clientOperations && !other->_clientOperations) || [self->_clientOperations isEqual:other->_clientOperations])
    &&
    ((self->_has.reportClientOperationFrequency && other->_has.reportClientOperationFrequency && self->_reportClientOperationFrequency == other->_reportClientOperationFrequency) || (!self->_has.reportClientOperationFrequency && !other->_has.reportClientOperationFrequency))
    &&
    ((self->_has.reportClientOperationFrequencyBase && other->_has.reportClientOperationFrequencyBase && self->_reportClientOperationFrequencyBase == other->_reportClientOperationFrequencyBase) || (!self->_has.reportClientOperationFrequencyBase && !other->_has.reportClientOperationFrequencyBase))
    ;
}

- (NSUInteger)hash
{
    return 0
    ^
    [self->_clientProcessVersion hash]
    ^
    [self->_clientBundleId hash]
    ^
    [self->_container hash]
    ^
    [self->_environment hash]
    ^
    (self->_has.anonymous ? PBHashInt((NSUInteger)self->_anonymous) : 0)
    ^
    [self->_operationGroups hash]
    ^
    (self->_has.reportOperationGroupFrequency ? PBHashInt((NSUInteger)self->_reportOperationGroupFrequency) : 0)
    ^
    (self->_has.reportOperationGroupFrequencyBase ? PBHashInt((NSUInteger)self->_reportOperationGroupFrequencyBase) : 0)
    ^
    [self->_clientOperations hash]
    ^
    (self->_has.reportClientOperationFrequency ? PBHashInt((NSUInteger)self->_reportClientOperationFrequency) : 0)
    ^
    (self->_has.reportClientOperationFrequencyBase ? PBHashInt((NSUInteger)self->_reportClientOperationFrequencyBase) : 0)
    ;
}

- (void)mergeFrom:(SECC2MPCloudKitInfo *)other
{
    if (other->_clientProcessVersion)
    {
        [self setClientProcessVersion:other->_clientProcessVersion];
    }
    if (other->_clientBundleId)
    {
        [self setClientBundleId:other->_clientBundleId];
    }
    if (other->_container)
    {
        [self setContainer:other->_container];
    }
    if (other->_environment)
    {
        [self setEnvironment:other->_environment];
    }
    if (other->_has.anonymous)
    {
        self->_anonymous = other->_anonymous;
        self->_has.anonymous = YES;
    }
    for (SECC2MPCloudKitOperationGroupInfo *iter_operationGroups in other->_operationGroups)
    {
        [self addOperationGroup:iter_operationGroups];
    }
    if (other->_has.reportOperationGroupFrequency)
    {
        self->_reportOperationGroupFrequency = other->_reportOperationGroupFrequency;
        self->_has.reportOperationGroupFrequency = YES;
    }
    if (other->_has.reportOperationGroupFrequencyBase)
    {
        self->_reportOperationGroupFrequencyBase = other->_reportOperationGroupFrequencyBase;
        self->_has.reportOperationGroupFrequencyBase = YES;
    }
    for (SECC2MPCloudKitOperationInfo *iter_clientOperations in other->_clientOperations)
    {
        [self addClientOperation:iter_clientOperations];
    }
    if (other->_has.reportClientOperationFrequency)
    {
        self->_reportClientOperationFrequency = other->_reportClientOperationFrequency;
        self->_has.reportClientOperationFrequency = YES;
    }
    if (other->_has.reportClientOperationFrequencyBase)
    {
        self->_reportClientOperationFrequencyBase = other->_reportClientOperationFrequencyBase;
        self->_has.reportClientOperationFrequencyBase = YES;
    }
}

@end

