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

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

- (BOOL)hasServiceName
{
    return _serviceName != nil;
}
@synthesize serviceName = _serviceName;
- (BOOL)hasPartition
{
    return _partition != nil;
}
@synthesize partition = _partition;
- (BOOL)hasServiceBuild
{
    return _serviceBuild != nil;
}
@synthesize serviceBuild = _serviceBuild;
- (BOOL)hasServiceInstance
{
    return _serviceInstance != nil;
}
@synthesize serviceInstance = _serviceInstance;

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

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    if (self->_serviceName)
    {
        [dict setObject:self->_serviceName forKey:@"service_name"];
    }
    if (self->_partition)
    {
        [dict setObject:self->_partition forKey:@"partition"];
    }
    if (self->_serviceBuild)
    {
        [dict setObject:self->_serviceBuild forKey:@"service_build"];
    }
    if (self->_serviceInstance)
    {
        [dict setObject:self->_serviceInstance forKey:@"service_instance"];
    }
    return dict;
}

BOOL SECC2MPServerInfoReadFrom(__unsafe_unretained SECC2MPServerInfo *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 /* serviceName */:
            {
                NSString *new_serviceName = PBReaderReadString(reader);
                self->_serviceName = new_serviceName;
            }
            break;
            case 103 /* partition */:
            {
                NSString *new_partition = PBReaderReadString(reader);
                self->_partition = new_partition;
            }
            break;
            case 104 /* serviceBuild */:
            {
                NSString *new_serviceBuild = PBReaderReadString(reader);
                self->_serviceBuild = new_serviceBuild;
            }
            break;
            case 105 /* serviceInstance */:
            {
                NSString *new_serviceInstance = PBReaderReadString(reader);
                self->_serviceInstance = new_serviceInstance;
            }
            break;
            default:
                if (!PBReaderSkipValueWithTag(reader, tag, aType))
                    return NO;
                break;
        }
    }
    return !PBReaderHasError(reader);
}

- (BOOL)readFrom:(PBDataReader *)reader
{
    return SECC2MPServerInfoReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
    /* serviceName */
    {
        if (self->_serviceName)
        {
            PBDataWriterWriteStringField(writer, self->_serviceName, 102);
        }
    }
    /* partition */
    {
        if (self->_partition)
        {
            PBDataWriterWriteStringField(writer, self->_partition, 103);
        }
    }
    /* serviceBuild */
    {
        if (self->_serviceBuild)
        {
            PBDataWriterWriteStringField(writer, self->_serviceBuild, 104);
        }
    }
    /* serviceInstance */
    {
        if (self->_serviceInstance)
        {
            PBDataWriterWriteStringField(writer, self->_serviceInstance, 105);
        }
    }
}

- (void)copyTo:(SECC2MPServerInfo *)other
{
    if (_serviceName)
    {
        other.serviceName = _serviceName;
    }
    if (_partition)
    {
        other.partition = _partition;
    }
    if (_serviceBuild)
    {
        other.serviceBuild = _serviceBuild;
    }
    if (_serviceInstance)
    {
        other.serviceInstance = _serviceInstance;
    }
}

- (id)copyWithZone:(NSZone *)zone
{
    SECC2MPServerInfo *copy = [[[self class] allocWithZone:zone] init];
    copy->_serviceName = [_serviceName copyWithZone:zone];
    copy->_partition = [_partition copyWithZone:zone];
    copy->_serviceBuild = [_serviceBuild copyWithZone:zone];
    copy->_serviceInstance = [_serviceInstance copyWithZone:zone];
    return copy;
}

- (BOOL)isEqual:(id)object
{
    SECC2MPServerInfo *other = (SECC2MPServerInfo *)object;
    return [other isMemberOfClass:[self class]]
    &&
    ((!self->_serviceName && !other->_serviceName) || [self->_serviceName isEqual:other->_serviceName])
    &&
    ((!self->_partition && !other->_partition) || [self->_partition isEqual:other->_partition])
    &&
    ((!self->_serviceBuild && !other->_serviceBuild) || [self->_serviceBuild isEqual:other->_serviceBuild])
    &&
    ((!self->_serviceInstance && !other->_serviceInstance) || [self->_serviceInstance isEqual:other->_serviceInstance])
    ;
}

- (NSUInteger)hash
{
    return 0
    ^
    [self->_serviceName hash]
    ^
    [self->_partition hash]
    ^
    [self->_serviceBuild hash]
    ^
    [self->_serviceInstance hash]
    ;
}

- (void)mergeFrom:(SECC2MPServerInfo *)other
{
    if (other->_serviceName)
    {
        [self setServiceName:other->_serviceName];
    }
    if (other->_partition)
    {
        [self setPartition:other->_partition];
    }
    if (other->_serviceBuild)
    {
        [self setServiceBuild:other->_serviceBuild];
    }
    if (other->_serviceInstance)
    {
        [self setServiceInstance:other->_serviceInstance];
    }
}

@end

