// This file was automatically generated by protocompiler
// DO NOT EDIT!
// Compiled from stdin

#import <TargetConditionals.h>
#if !TARGET_OS_BRIDGE

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

@synthesize timestamp = _timestamp;
- (void)setTimestamp:(uint64_t)v
{
    _has.timestamp = YES;
    _timestamp = v;
}
- (void)setHasTimestamp:(BOOL)f
{
    _has.timestamp = f;
}
- (BOOL)hasTimestamp
{
    return _has.timestamp;
}
@synthesize durationMsec = _durationMsec;
- (void)setDurationMsec:(int64_t)v
{
    _has.durationMsec = YES;
    _durationMsec = v;
}
- (void)setHasDurationMsec:(BOOL)f
{
    _has.durationMsec = f;
}
- (BOOL)hasDurationMsec
{
    return _has.durationMsec;
}
- (BOOL)hasRatelimitertype
{
    return _ratelimitertype != nil;
}
@synthesize ratelimitertype = _ratelimitertype;

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

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    if (self->_has.timestamp)
    {
        [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_timestamp] forKey:@"timestamp"];
    }
    if (self->_has.durationMsec)
    {
        [dict setObject:[NSNumber numberWithLongLong:self->_durationMsec] forKey:@"durationMsec"];
    }
    if (self->_ratelimitertype)
    {
        [dict setObject:self->_ratelimitertype forKey:@"ratelimitertype"];
    }
    return dict;
}

BOOL AWDKeychainCKKSRateLimiterOverloadReadFrom(__unsafe_unretained AWDKeychainCKKSRateLimiterOverload *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 /* timestamp */:
            {
                self->_has.timestamp = YES;
                self->_timestamp = PBReaderReadUint64(reader);
            }
            break;
            case 2 /* durationMsec */:
            {
                self->_has.durationMsec = YES;
                self->_durationMsec = PBReaderReadInt64(reader);
            }
            break;
            case 3 /* ratelimitertype */:
            {
                NSString *new_ratelimitertype = PBReaderReadString(reader);
                self->_ratelimitertype = new_ratelimitertype;
            }
            break;
            default:
                if (!PBReaderSkipValueWithTag(reader, tag, aType))
                    return NO;
                break;
        }
    }
    return !PBReaderHasError(reader);
}

- (BOOL)readFrom:(PBDataReader *)reader
{
    return AWDKeychainCKKSRateLimiterOverloadReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
    /* timestamp */
    {
        if (self->_has.timestamp)
        {
            PBDataWriterWriteUint64Field(writer, self->_timestamp, 1);
        }
    }
    /* durationMsec */
    {
        if (self->_has.durationMsec)
        {
            PBDataWriterWriteInt64Field(writer, self->_durationMsec, 2);
        }
    }
    /* ratelimitertype */
    {
        if (self->_ratelimitertype)
        {
            PBDataWriterWriteStringField(writer, self->_ratelimitertype, 3);
        }
    }
}

- (void)copyTo:(AWDKeychainCKKSRateLimiterOverload *)other
{
    if (self->_has.timestamp)
    {
        other->_timestamp = _timestamp;
        other->_has.timestamp = YES;
    }
    if (self->_has.durationMsec)
    {
        other->_durationMsec = _durationMsec;
        other->_has.durationMsec = YES;
    }
    if (_ratelimitertype)
    {
        other.ratelimitertype = _ratelimitertype;
    }
}

- (id)copyWithZone:(NSZone *)zone
{
    AWDKeychainCKKSRateLimiterOverload *copy = [[[self class] allocWithZone:zone] init];
    if (self->_has.timestamp)
    {
        copy->_timestamp = _timestamp;
        copy->_has.timestamp = YES;
    }
    if (self->_has.durationMsec)
    {
        copy->_durationMsec = _durationMsec;
        copy->_has.durationMsec = YES;
    }
    copy->_ratelimitertype = [_ratelimitertype copyWithZone:zone];
    return copy;
}

- (BOOL)isEqual:(id)object
{
    AWDKeychainCKKSRateLimiterOverload *other = (AWDKeychainCKKSRateLimiterOverload *)object;
    return [other isMemberOfClass:[self class]]
    &&
    ((self->_has.timestamp && other->_has.timestamp && self->_timestamp == other->_timestamp) || (!self->_has.timestamp && !other->_has.timestamp))
    &&
    ((self->_has.durationMsec && other->_has.durationMsec && self->_durationMsec == other->_durationMsec) || (!self->_has.durationMsec && !other->_has.durationMsec))
    &&
    ((!self->_ratelimitertype && !other->_ratelimitertype) || [self->_ratelimitertype isEqual:other->_ratelimitertype])
    ;
}

- (NSUInteger)hash
{
    return 0
    ^
    (self->_has.timestamp ? PBHashInt((NSUInteger)self->_timestamp) : 0)
    ^
    (self->_has.durationMsec ? PBHashInt((NSUInteger)self->_durationMsec) : 0)
    ^
    [self->_ratelimitertype hash]
    ;
}

- (void)mergeFrom:(AWDKeychainCKKSRateLimiterOverload *)other
{
    if (other->_has.timestamp)
    {
        self->_timestamp = other->_timestamp;
        self->_has.timestamp = YES;
    }
    if (other->_has.durationMsec)
    {
        self->_durationMsec = other->_durationMsec;
        self->_has.durationMsec = YES;
    }
    if (other->_ratelimitertype)
    {
        [self setRatelimitertype:other->_ratelimitertype];
    }
}

@end
#endif
