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

#import "SECC2MPInternalTestConfig.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 SECC2MPInternalTestConfig

- (BOOL)hasKey
{
    return _key != nil;
}
@synthesize key = _key;
- (BOOL)hasValue
{
    return _value != nil;
}
@synthesize value = _value;

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

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    if (self->_key)
    {
        [dict setObject:self->_key forKey:@"key"];
    }
    if (self->_value)
    {
        [dict setObject:self->_value forKey:@"value"];
    }
    return dict;
}

BOOL SECC2MPInternalTestConfigReadFrom(__unsafe_unretained SECC2MPInternalTestConfig *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 101 /* key */:
            {
                NSString *new_key = PBReaderReadString(reader);
                self->_key = new_key;
            }
            break;
            case 102 /* value */:
            {
                NSString *new_value = PBReaderReadString(reader);
                self->_value = new_value;
            }
            break;
            default:
                if (!PBReaderSkipValueWithTag(reader, tag, aType))
                    return NO;
                break;
        }
    }
    return !PBReaderHasError(reader);
}

- (BOOL)readFrom:(PBDataReader *)reader
{
    return SECC2MPInternalTestConfigReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
    /* key */
    {
        if (self->_key)
        {
            PBDataWriterWriteStringField(writer, self->_key, 101);
        }
    }
    /* value */
    {
        if (self->_value)
        {
            PBDataWriterWriteStringField(writer, self->_value, 102);
        }
    }
}

- (void)copyTo:(SECC2MPInternalTestConfig *)other
{
    if (_key)
    {
        other.key = _key;
    }
    if (_value)
    {
        other.value = _value;
    }
}

- (id)copyWithZone:(NSZone *)zone
{
    SECC2MPInternalTestConfig *copy = [[[self class] allocWithZone:zone] init];
    copy->_key = [_key copyWithZone:zone];
    copy->_value = [_value copyWithZone:zone];
    return copy;
}

- (BOOL)isEqual:(id)object
{
    SECC2MPInternalTestConfig *other = (SECC2MPInternalTestConfig *)object;
    return [other isMemberOfClass:[self class]]
    &&
    ((!self->_key && !other->_key) || [self->_key isEqual:other->_key])
    &&
    ((!self->_value && !other->_value) || [self->_value isEqual:other->_value])
    ;
}

- (NSUInteger)hash
{
    return 0
    ^
    [self->_key hash]
    ^
    [self->_value hash]
    ;
}

- (void)mergeFrom:(SECC2MPInternalTestConfig *)other
{
    if (other->_key)
    {
        [self setKey:other->_key];
    }
    if (other->_value)
    {
        [self setValue:other->_value];
    }
}

@end

