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

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

@synthesize pendingBackupPeers = _pendingBackupPeers;
- (void)clearPendingBackupPeers
{
    [_pendingBackupPeers removeAllObjects];
}
- (void)addPendingBackupPeers:(NSString *)i
{
    if (!_pendingBackupPeers)
    {
        _pendingBackupPeers = [[NSMutableArray alloc] init];
    }
    [_pendingBackupPeers addObject:i];
}
- (NSUInteger)pendingBackupPeersCount
{
    return [_pendingBackupPeers count];
}
- (NSString *)pendingBackupPeersAtIndex:(NSUInteger)idx
{
    return [_pendingBackupPeers objectAtIndex:idx];
}
+ (Class)pendingBackupPeersType
{
    return [NSString class];
}

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

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

BOOL SOSAccountConfigurationReadFrom(__unsafe_unretained SOSAccountConfiguration *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 /* pendingBackupPeers */:
            {
                NSString *new_pendingBackupPeers = PBReaderReadString(reader);
                if (new_pendingBackupPeers)
                {
                    [self addPendingBackupPeers:new_pendingBackupPeers];
                }
            }
            break;
            default:
                if (!PBReaderSkipValueWithTag(reader, tag, aType))
                    return NO;
                break;
        }
    }
    return !PBReaderHasError(reader);
}

- (BOOL)readFrom:(PBDataReader *)reader
{
    return SOSAccountConfigurationReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
    /* pendingBackupPeers */
    {
        for (NSString *s_pendingBackupPeers in self->_pendingBackupPeers)
        {
            PBDataWriterWriteStringField(writer, s_pendingBackupPeers, 1);
        }
    }
}

- (void)copyTo:(SOSAccountConfiguration *)other
{
    if ([self pendingBackupPeersCount])
    {
        [other clearPendingBackupPeers];
        NSUInteger pendingBackupPeersCnt = [self pendingBackupPeersCount];
        for (NSUInteger i = 0; i < pendingBackupPeersCnt; i++)
        {
            [other addPendingBackupPeers:[self pendingBackupPeersAtIndex:i]];
        }
    }
}

- (id)copyWithZone:(NSZone *)zone
{
    SOSAccountConfiguration *copy = [[[self class] allocWithZone:zone] init];
    for (NSString *v in _pendingBackupPeers)
    {
        NSString *vCopy = [v copyWithZone:zone];
        [copy addPendingBackupPeers:vCopy];
    }
    return copy;
}

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

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

- (void)mergeFrom:(SOSAccountConfiguration *)other
{
    for (NSString *iter_pendingBackupPeers in other->_pendingBackupPeers)
    {
        [self addPendingBackupPeers:iter_pendingBackupPeers];
    }
}

@end

