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

#import "SECC2MPCloudKitOperationGroupInfo.h"
#import <ProtocolBuffer/PBConstants.h>
#import <ProtocolBuffer/PBHashUtil.h>
#import <ProtocolBuffer/PBDataReader.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 SECC2MPCloudKitOperationGroupInfo

- (BOOL)hasOperationGroupId
{
    return _operationGroupId != nil;
}
@synthesize operationGroupId = _operationGroupId;
- (BOOL)hasOperationGroupName
{
    return _operationGroupName != nil;
}
@synthesize operationGroupName = _operationGroupName;
@synthesize operationGroupTriggered = _operationGroupTriggered;
- (void)setOperationGroupTriggered:(BOOL)v
{
    _has.operationGroupTriggered = YES;
    _operationGroupTriggered = v;
}
- (void)setHasOperationGroupTriggered:(BOOL)f
{
    _has.operationGroupTriggered = f;
}
- (BOOL)hasOperationGroupTriggered
{
    return _has.operationGroupTriggered;
}

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

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    if (self->_operationGroupId)
    {
        [dict setObject:self->_operationGroupId forKey:@"operation_group_id"];
    }
    if (self->_operationGroupName)
    {
        [dict setObject:self->_operationGroupName forKey:@"operation_group_name"];
    }
    if (self->_has.operationGroupTriggered)
    {
        [dict setObject:[NSNumber numberWithBool:self->_operationGroupTriggered] forKey:@"operation_group_triggered"];
    }
    return dict;
}

BOOL SECC2MPCloudKitOperationGroupInfoReadFrom(__unsafe_unretained SECC2MPCloudKitOperationGroupInfo *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 1 /* operationGroupId */:
            {
                NSString *new_operationGroupId = PBReaderReadString(reader);
                self->_operationGroupId = new_operationGroupId;
            }
            break;
            case 2 /* operationGroupName */:
            {
                NSString *new_operationGroupName = PBReaderReadString(reader);
                self->_operationGroupName = new_operationGroupName;
            }
            break;
            case 101 /* operationGroupTriggered */:
            {
                self->_has.operationGroupTriggered = YES;
                self->_operationGroupTriggered = PBReaderReadBOOL(reader);
            }
            break;
            default:
                if (!PBReaderSkipValueWithTag(reader, tag, aType))
                    return NO;
                break;
        }
    }
    return !PBReaderHasError(reader);
}

- (BOOL)readFrom:(PBDataReader *)reader
{
    return SECC2MPCloudKitOperationGroupInfoReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
    /* operationGroupId */
    {
        if (self->_operationGroupId)
        {
            PBDataWriterWriteStringField(writer, self->_operationGroupId, 1);
        }
    }
    /* operationGroupName */
    {
        if (self->_operationGroupName)
        {
            PBDataWriterWriteStringField(writer, self->_operationGroupName, 2);
        }
    }
    /* operationGroupTriggered */
    {
        if (self->_has.operationGroupTriggered)
        {
            PBDataWriterWriteBOOLField(writer, self->_operationGroupTriggered, 101);
        }
    }
}

- (void)copyTo:(SECC2MPCloudKitOperationGroupInfo *)other
{
    if (_operationGroupId)
    {
        other.operationGroupId = _operationGroupId;
    }
    if (_operationGroupName)
    {
        other.operationGroupName = _operationGroupName;
    }
    if (self->_has.operationGroupTriggered)
    {
        other->_operationGroupTriggered = _operationGroupTriggered;
        other->_has.operationGroupTriggered = YES;
    }
}

- (id)copyWithZone:(NSZone *)zone
{
    SECC2MPCloudKitOperationGroupInfo *copy = [[[self class] allocWithZone:zone] init];
    copy->_operationGroupId = [_operationGroupId copyWithZone:zone];
    copy->_operationGroupName = [_operationGroupName copyWithZone:zone];
    if (self->_has.operationGroupTriggered)
    {
        copy->_operationGroupTriggered = _operationGroupTriggered;
        copy->_has.operationGroupTriggered = YES;
    }
    return copy;
}

- (BOOL)isEqual:(id)object
{
    SECC2MPCloudKitOperationGroupInfo *other = (SECC2MPCloudKitOperationGroupInfo *)object;
    return [other isMemberOfClass:[self class]]
    &&
    ((!self->_operationGroupId && !other->_operationGroupId) || [self->_operationGroupId isEqual:other->_operationGroupId])
    &&
    ((!self->_operationGroupName && !other->_operationGroupName) || [self->_operationGroupName isEqual:other->_operationGroupName])
    &&
    ((self->_has.operationGroupTriggered && other->_has.operationGroupTriggered && ((self->_operationGroupTriggered && other->_operationGroupTriggered) || (!self->_operationGroupTriggered && !other->_operationGroupTriggered))) || (!self->_has.operationGroupTriggered && !other->_has.operationGroupTriggered))
    ;
}

- (NSUInteger)hash
{
    return 0
    ^
    [self->_operationGroupId hash]
    ^
    [self->_operationGroupName hash]
    ^
    (self->_has.operationGroupTriggered ? PBHashInt((NSUInteger)self->_operationGroupTriggered) : 0)
    ;
}

- (void)mergeFrom:(SECC2MPCloudKitOperationGroupInfo *)other
{
    if (other->_operationGroupId)
    {
        [self setOperationGroupId:other->_operationGroupId];
    }
    if (other->_operationGroupName)
    {
        [self setOperationGroupName:other->_operationGroupName];
    }
    if (other->_has.operationGroupTriggered)
    {
        self->_operationGroupTriggered = other->_operationGroupTriggered;
        self->_has.operationGroupTriggered = YES;
    }
}

@end

