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

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

@synthesize epoch = _epoch;
- (void)setEpoch:(uint64_t)v
{
    _has.epoch = YES;
    _epoch = v;
}
- (void)setHasEpoch:(BOOL)f
{
    _has.epoch = f;
}
- (BOOL)hasEpoch
{
    return _has.epoch != 0;
}

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

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    if (self->_has.epoch)
    {
        [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_epoch] forKey:@"epoch"];
    }
    return dict;
}

BOOL OTSponsorToApplicantRound1M2ReadFrom(__unsafe_unretained OTSponsorToApplicantRound1M2 *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 /* epoch */:
            {
                self->_has.epoch = YES;
                self->_epoch = PBReaderReadUint64(reader);
            }
            break;
            default:
                if (!PBReaderSkipValueWithTag(reader, tag, aType))
                    return NO;
                break;
        }
    }
    return !PBReaderHasError(reader);
}

- (BOOL)readFrom:(PBDataReader *)reader
{
    return OTSponsorToApplicantRound1M2ReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
    /* epoch */
    {
        if (self->_has.epoch)
        {
            PBDataWriterWriteUint64Field(writer, self->_epoch, 1);
        }
    }
}

- (void)copyTo:(OTSponsorToApplicantRound1M2 *)other
{
    if (self->_has.epoch)
    {
        other->_epoch = _epoch;
        other->_has.epoch = YES;
    }
}

- (id)copyWithZone:(NSZone *)zone
{
    OTSponsorToApplicantRound1M2 *copy = [[[self class] allocWithZone:zone] init];
    if (self->_has.epoch)
    {
        copy->_epoch = _epoch;
        copy->_has.epoch = YES;
    }
    return copy;
}

- (BOOL)isEqual:(id)object
{
    OTSponsorToApplicantRound1M2 *other = (OTSponsorToApplicantRound1M2 *)object;
    return [other isMemberOfClass:[self class]]
    &&
    ((self->_has.epoch && other->_has.epoch && self->_epoch == other->_epoch) || (!self->_has.epoch && !other->_has.epoch))
    ;
}

- (NSUInteger)hash
{
    return 0
    ^
    (self->_has.epoch ? PBHashInt((NSUInteger)self->_epoch) : 0)
    ;
}

- (void)mergeFrom:(OTSponsorToApplicantRound1M2 *)other
{
    if (other->_has.epoch)
    {
        self->_epoch = other->_epoch;
        self->_has.epoch = YES;
    }
}

@end

