// Generated by the protocol buffer compiler.  DO NOT EDIT!

#import "SubProtocol.pb.h"
// @@protoc_insertion_point(imports)

@implementation SubProtocolRoot
static PBExtensionRegistry *extensionRegistry = nil;
+ (PBExtensionRegistry *)extensionRegistry {
    return extensionRegistry;
}

+ (void)initialize {
    if (self == [SubProtocolRoot class]) {
        PBMutableExtensionRegistry *registry = [PBMutableExtensionRegistry registry];
        [self registerAllExtensions:registry];
        extensionRegistry = registry;
    }
}
+ (void)registerAllExtensions:(PBMutableExtensionRegistry *)registry {
}
@end

@interface WebSocketRequestMessage ()
@property (strong) NSString *verb;
@property (strong) NSString *path;
@property (strong) NSData *body;
@property UInt64 id;
@end

@implementation WebSocketRequestMessage

- (BOOL)hasVerb {
    return !!hasVerb_;
}
- (void)setHasVerb:(BOOL)value_ {
    hasVerb_ = !!value_;
}
@synthesize verb;
- (BOOL)hasPath {
    return !!hasPath_;
}
- (void)setHasPath:(BOOL)value_ {
    hasPath_ = !!value_;
}
@synthesize path;
- (BOOL)hasBody {
    return !!hasBody_;
}
- (void)setHasBody:(BOOL)value_ {
    hasBody_ = !!value_;
}
@synthesize body;
- (BOOL)hasId {
    return !!hasId_;
}
- (void)setHasId:(BOOL)value_ {
    hasId_ = !!value_;
}
@synthesize id;
- (id)init {
    if ((self = [super init])) {
        self.verb = @"";
        self.path = @"";
        self.body = [NSData data];
        self.id   = 0L;
    }
    return self;
}
static WebSocketRequestMessage *defaultWebSocketRequestMessageInstance = nil;
+ (void)initialize {
    if (self == [WebSocketRequestMessage class]) {
        defaultWebSocketRequestMessageInstance = [[WebSocketRequestMessage alloc] init];
    }
}
+ (WebSocketRequestMessage *)defaultInstance {
    return defaultWebSocketRequestMessageInstance;
}
- (WebSocketRequestMessage *)defaultInstance {
    return defaultWebSocketRequestMessageInstance;
}
- (BOOL)isInitialized {
    return YES;
}
- (void)writeToCodedOutputStream:(PBCodedOutputStream *)output {
    if (self.hasVerb) {
        [output writeString:1 value:self.verb];
    }
    if (self.hasPath) {
        [output writeString:2 value:self.path];
    }
    if (self.hasBody) {
        [output writeData:3 value:self.body];
    }
    if (self.hasId) {
        [output writeUInt64:4 value:self.id];
    }
    [self.unknownFields writeToCodedOutputStream:output];
}
- (SInt32)serializedSize {
    __block SInt32 size_ = memoizedSerializedSize;
    if (size_ != -1) {
        return size_;
    }

    size_ = 0;
    if (self.hasVerb) {
        size_ += computeStringSize(1, self.verb);
    }
    if (self.hasPath) {
        size_ += computeStringSize(2, self.path);
    }
    if (self.hasBody) {
        size_ += computeDataSize(3, self.body);
    }
    if (self.hasId) {
        size_ += computeUInt64Size(4, self.id);
    }
    size_ += self.unknownFields.serializedSize;
    memoizedSerializedSize = size_;
    return size_;
}
+ (WebSocketRequestMessage *)parseFromData:(NSData *)data {
    return (WebSocketRequestMessage *)[[[WebSocketRequestMessage builder] mergeFromData:data] build];
}
+ (WebSocketRequestMessage *)parseFromData:(NSData *)data extensionRegistry:(PBExtensionRegistry *)extensionRegistry {
    return (WebSocketRequestMessage *)[
        [[WebSocketRequestMessage builder] mergeFromData:data extensionRegistry:extensionRegistry] build];
}
+ (WebSocketRequestMessage *)parseFromInputStream:(NSInputStream *)input {
    return (WebSocketRequestMessage *)[[[WebSocketRequestMessage builder] mergeFromInputStream:input] build];
}
+ (WebSocketRequestMessage *)parseFromInputStream:(NSInputStream *)input
                                extensionRegistry:(PBExtensionRegistry *)extensionRegistry {
    return (WebSocketRequestMessage *)[
        [[WebSocketRequestMessage builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build];
}
+ (WebSocketRequestMessage *)parseFromCodedInputStream:(PBCodedInputStream *)input {
    return (WebSocketRequestMessage *)[[[WebSocketRequestMessage builder] mergeFromCodedInputStream:input] build];
}
+ (WebSocketRequestMessage *)parseFromCodedInputStream:(PBCodedInputStream *)input
                                     extensionRegistry:(PBExtensionRegistry *)extensionRegistry {
    return (WebSocketRequestMessage *)[
        [[WebSocketRequestMessage builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build];
}
+ (WebSocketRequestMessageBuilder *)builder {
    return [[WebSocketRequestMessageBuilder alloc] init];
}
+ (WebSocketRequestMessageBuilder *)builderWithPrototype:(WebSocketRequestMessage *)prototype {
    return [[WebSocketRequestMessage builder] mergeFrom:prototype];
}
- (WebSocketRequestMessageBuilder *)builder {
    return [WebSocketRequestMessage builder];
}
- (WebSocketRequestMessageBuilder *)toBuilder {
    return [WebSocketRequestMessage builderWithPrototype:self];
}
- (void)writeDescriptionTo:(NSMutableString *)output withIndent:(NSString *)indent {
    if (self.hasVerb) {
        [output appendFormat:@"%@%@: %@\n", indent, @"verb", self.verb];
    }
    if (self.hasPath) {
        [output appendFormat:@"%@%@: %@\n", indent, @"path", self.path];
    }
    if (self.hasBody) {
        [output appendFormat:@"%@%@: %@\n", indent, @"body", self.body];
    }
    if (self.hasId) {
        [output appendFormat:@"%@%@: %@\n", indent, @"id", [NSNumber numberWithLongLong:self.id]];
    }
    [self.unknownFields writeDescriptionTo:output withIndent:indent];
}
- (BOOL)isEqual:(id)other {
    if (other == self) {
        return YES;
    }
    if (![other isKindOfClass:[WebSocketRequestMessage class]]) {
        return NO;
    }
    WebSocketRequestMessage *otherMessage = other;
    return self.hasVerb == otherMessage.hasVerb && (!self.hasVerb || [self.verb isEqual:otherMessage.verb]) &&
           self.hasPath == otherMessage.hasPath && (!self.hasPath || [self.path isEqual:otherMessage.path]) &&
           self.hasBody == otherMessage.hasBody && (!self.hasBody || [self.body isEqual:otherMessage.body]) &&
           self.hasId == otherMessage.hasId && (!self.hasId || self.id == otherMessage.id) &&
           (self.unknownFields == otherMessage.unknownFields ||
            (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields]));
}
- (NSUInteger)hash {
    __block NSUInteger hashCode = 7;
    if (self.hasVerb) {
        hashCode = hashCode * 31 + [self.verb hash];
    }
    if (self.hasPath) {
        hashCode = hashCode * 31 + [self.path hash];
    }
    if (self.hasBody) {
        hashCode = hashCode * 31 + [self.body hash];
    }
    if (self.hasId) {
        hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.id] hash];
    }
    hashCode = hashCode * 31 + [self.unknownFields hash];
    return hashCode;
}
@end

@interface WebSocketRequestMessageBuilder ()
@property (strong) WebSocketRequestMessage *result;
@end

@implementation WebSocketRequestMessageBuilder
@synthesize result;
- (id)init {
    if ((self = [super init])) {
        self.result = [[WebSocketRequestMessage alloc] init];
    }
    return self;
}
- (PBGeneratedMessage *)internalGetResult {
    return result;
}
- (WebSocketRequestMessageBuilder *)clear {
    self.result = [[WebSocketRequestMessage alloc] init];
    return self;
}
- (WebSocketRequestMessageBuilder *)clone {
    return [WebSocketRequestMessage builderWithPrototype:result];
}
- (WebSocketRequestMessage *)defaultInstance {
    return [WebSocketRequestMessage defaultInstance];
}
- (WebSocketRequestMessage *)build {
    [self checkInitialized];
    return [self buildPartial];
}
- (WebSocketRequestMessage *)buildPartial {
    WebSocketRequestMessage *returnMe = result;
    self.result                       = nil;
    return returnMe;
}
- (WebSocketRequestMessageBuilder *)mergeFrom:(WebSocketRequestMessage *)other {
    if (other == [WebSocketRequestMessage defaultInstance]) {
        return self;
    }
    if (other.hasVerb) {
        [self setVerb:other.verb];
    }
    if (other.hasPath) {
        [self setPath:other.path];
    }
    if (other.hasBody) {
        [self setBody:other.body];
    }
    if (other.hasId) {
        [self setId:other.id];
    }
    [self mergeUnknownFields:other.unknownFields];
    return self;
}
- (WebSocketRequestMessageBuilder *)mergeFromCodedInputStream:(PBCodedInputStream *)input {
    return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]];
}
- (WebSocketRequestMessageBuilder *)mergeFromCodedInputStream:(PBCodedInputStream *)input
                                            extensionRegistry:(PBExtensionRegistry *)extensionRegistry {
    PBUnknownFieldSetBuilder *unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields];
    while (YES) {
        SInt32 tag = [input readTag];
        switch (tag) {
            case 0:
                [self setUnknownFields:[unknownFields build]];
                return self;
            default: {
                if (![self parseUnknownField:input
                               unknownFields:unknownFields
                           extensionRegistry:extensionRegistry
                                         tag:tag]) {
                    [self setUnknownFields:[unknownFields build]];
                    return self;
                }
                break;
            }
            case 10: {
                [self setVerb:[input readString]];
                break;
            }
            case 18: {
                [self setPath:[input readString]];
                break;
            }
            case 26: {
                [self setBody:[input readData]];
                break;
            }
            case 32: {
                [self setId:[input readUInt64]];
                break;
            }
        }
    }
}
- (BOOL)hasVerb {
    return result.hasVerb;
}
- (NSString *)verb {
    return result.verb;
}
- (WebSocketRequestMessageBuilder *)setVerb:(NSString *)value {
    result.hasVerb = YES;
    result.verb    = value;
    return self;
}
- (WebSocketRequestMessageBuilder *)clearVerb {
    result.hasVerb = NO;
    result.verb    = @"";
    return self;
}
- (BOOL)hasPath {
    return result.hasPath;
}
- (NSString *)path {
    return result.path;
}
- (WebSocketRequestMessageBuilder *)setPath:(NSString *)value {
    result.hasPath = YES;
    result.path    = value;
    return self;
}
- (WebSocketRequestMessageBuilder *)clearPath {
    result.hasPath = NO;
    result.path    = @"";
    return self;
}
- (BOOL)hasBody {
    return result.hasBody;
}
- (NSData *)body {
    return result.body;
}
- (WebSocketRequestMessageBuilder *)setBody:(NSData *)value {
    result.hasBody = YES;
    result.body    = value;
    return self;
}
- (WebSocketRequestMessageBuilder *)clearBody {
    result.hasBody = NO;
    result.body    = [NSData data];
    return self;
}
- (BOOL)hasId {
    return result.hasId;
}
- (UInt64)id {
    return result.id;
}
- (WebSocketRequestMessageBuilder *)setId:(UInt64)value {
    result.hasId = YES;
    result.id    = value;
    return self;
}
- (WebSocketRequestMessageBuilder *)clearId {
    result.hasId = NO;
    result.id    = 0L;
    return self;
}
@end

@interface WebSocketResponseMessage ()
@property UInt64 id;
@property UInt32 status;
@property (strong) NSString *message;
@property (strong) NSData *body;
@end

@implementation WebSocketResponseMessage

- (BOOL)hasId {
    return !!hasId_;
}
- (void)setHasId:(BOOL)value_ {
    hasId_ = !!value_;
}
@synthesize id;
- (BOOL)hasStatus {
    return !!hasStatus_;
}
- (void)setHasStatus:(BOOL)value_ {
    hasStatus_ = !!value_;
}
@synthesize status;
- (BOOL)hasMessage {
    return !!hasMessage_;
}
- (void)setHasMessage:(BOOL)value_ {
    hasMessage_ = !!value_;
}
@synthesize message;
- (BOOL)hasBody {
    return !!hasBody_;
}
- (void)setHasBody:(BOOL)value_ {
    hasBody_ = !!value_;
}
@synthesize body;
- (id)init {
    if ((self = [super init])) {
        self.id      = 0L;
        self.status  = 0;
        self.message = @"";
        self.body    = [NSData data];
    }
    return self;
}
static WebSocketResponseMessage *defaultWebSocketResponseMessageInstance = nil;
+ (void)initialize {
    if (self == [WebSocketResponseMessage class]) {
        defaultWebSocketResponseMessageInstance = [[WebSocketResponseMessage alloc] init];
    }
}
+ (WebSocketResponseMessage *)defaultInstance {
    return defaultWebSocketResponseMessageInstance;
}
- (WebSocketResponseMessage *)defaultInstance {
    return defaultWebSocketResponseMessageInstance;
}
- (BOOL)isInitialized {
    return YES;
}
- (void)writeToCodedOutputStream:(PBCodedOutputStream *)output {
    if (self.hasId) {
        [output writeUInt64:1 value:self.id];
    }
    if (self.hasStatus) {
        [output writeUInt32:2 value:self.status];
    }
    if (self.hasMessage) {
        [output writeString:3 value:self.message];
    }
    if (self.hasBody) {
        [output writeData:4 value:self.body];
    }
    [self.unknownFields writeToCodedOutputStream:output];
}
- (SInt32)serializedSize {
    __block SInt32 size_ = memoizedSerializedSize;
    if (size_ != -1) {
        return size_;
    }

    size_ = 0;
    if (self.hasId) {
        size_ += computeUInt64Size(1, self.id);
    }
    if (self.hasStatus) {
        size_ += computeUInt32Size(2, self.status);
    }
    if (self.hasMessage) {
        size_ += computeStringSize(3, self.message);
    }
    if (self.hasBody) {
        size_ += computeDataSize(4, self.body);
    }
    size_ += self.unknownFields.serializedSize;
    memoizedSerializedSize = size_;
    return size_;
}
+ (WebSocketResponseMessage *)parseFromData:(NSData *)data {
    return (WebSocketResponseMessage *)[[[WebSocketResponseMessage builder] mergeFromData:data] build];
}
+ (WebSocketResponseMessage *)parseFromData:(NSData *)data extensionRegistry:(PBExtensionRegistry *)extensionRegistry {
    return (WebSocketResponseMessage *)[
        [[WebSocketResponseMessage builder] mergeFromData:data extensionRegistry:extensionRegistry] build];
}
+ (WebSocketResponseMessage *)parseFromInputStream:(NSInputStream *)input {
    return (WebSocketResponseMessage *)[[[WebSocketResponseMessage builder] mergeFromInputStream:input] build];
}
+ (WebSocketResponseMessage *)parseFromInputStream:(NSInputStream *)input
                                 extensionRegistry:(PBExtensionRegistry *)extensionRegistry {
    return (WebSocketResponseMessage *)[
        [[WebSocketResponseMessage builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build];
}
+ (WebSocketResponseMessage *)parseFromCodedInputStream:(PBCodedInputStream *)input {
    return (WebSocketResponseMessage *)[[[WebSocketResponseMessage builder] mergeFromCodedInputStream:input] build];
}
+ (WebSocketResponseMessage *)parseFromCodedInputStream:(PBCodedInputStream *)input
                                      extensionRegistry:(PBExtensionRegistry *)extensionRegistry {
    return (WebSocketResponseMessage *)[
        [[WebSocketResponseMessage builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build];
}
+ (WebSocketResponseMessageBuilder *)builder {
    return [[WebSocketResponseMessageBuilder alloc] init];
}
+ (WebSocketResponseMessageBuilder *)builderWithPrototype:(WebSocketResponseMessage *)prototype {
    return [[WebSocketResponseMessage builder] mergeFrom:prototype];
}
- (WebSocketResponseMessageBuilder *)builder {
    return [WebSocketResponseMessage builder];
}
- (WebSocketResponseMessageBuilder *)toBuilder {
    return [WebSocketResponseMessage builderWithPrototype:self];
}
- (void)writeDescriptionTo:(NSMutableString *)output withIndent:(NSString *)indent {
    if (self.hasId) {
        [output appendFormat:@"%@%@: %@\n", indent, @"id", [NSNumber numberWithLongLong:self.id]];
    }
    if (self.hasStatus) {
        [output appendFormat:@"%@%@: %@\n", indent, @"status", [NSNumber numberWithInteger:self.status]];
    }
    if (self.hasMessage) {
        [output appendFormat:@"%@%@: %@\n", indent, @"message", self.message];
    }
    if (self.hasBody) {
        [output appendFormat:@"%@%@: %@\n", indent, @"body", self.body];
    }
    [self.unknownFields writeDescriptionTo:output withIndent:indent];
}
- (BOOL)isEqual:(id)other {
    if (other == self) {
        return YES;
    }
    if (![other isKindOfClass:[WebSocketResponseMessage class]]) {
        return NO;
    }
    WebSocketResponseMessage *otherMessage = other;
    return self.hasId == otherMessage.hasId && (!self.hasId || self.id == otherMessage.id) &&
           self.hasStatus == otherMessage.hasStatus && (!self.hasStatus || self.status == otherMessage.status) &&
           self.hasMessage == otherMessage.hasMessage &&
           (!self.hasMessage || [self.message isEqual:otherMessage.message]) && self.hasBody == otherMessage.hasBody &&
           (!self.hasBody || [self.body isEqual:otherMessage.body]) &&
           (self.unknownFields == otherMessage.unknownFields ||
            (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields]));
}
- (NSUInteger)hash {
    __block NSUInteger hashCode = 7;
    if (self.hasId) {
        hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.id] hash];
    }
    if (self.hasStatus) {
        hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.status] hash];
    }
    if (self.hasMessage) {
        hashCode = hashCode * 31 + [self.message hash];
    }
    if (self.hasBody) {
        hashCode = hashCode * 31 + [self.body hash];
    }
    hashCode = hashCode * 31 + [self.unknownFields hash];
    return hashCode;
}
@end

@interface WebSocketResponseMessageBuilder ()
@property (strong) WebSocketResponseMessage *result;
@end

@implementation WebSocketResponseMessageBuilder
@synthesize result;
- (id)init {
    if ((self = [super init])) {
        self.result = [[WebSocketResponseMessage alloc] init];
    }
    return self;
}
- (PBGeneratedMessage *)internalGetResult {
    return result;
}
- (WebSocketResponseMessageBuilder *)clear {
    self.result = [[WebSocketResponseMessage alloc] init];
    return self;
}
- (WebSocketResponseMessageBuilder *)clone {
    return [WebSocketResponseMessage builderWithPrototype:result];
}
- (WebSocketResponseMessage *)defaultInstance {
    return [WebSocketResponseMessage defaultInstance];
}
- (WebSocketResponseMessage *)build {
    [self checkInitialized];
    return [self buildPartial];
}
- (WebSocketResponseMessage *)buildPartial {
    WebSocketResponseMessage *returnMe = result;
    self.result                        = nil;
    return returnMe;
}
- (WebSocketResponseMessageBuilder *)mergeFrom:(WebSocketResponseMessage *)other {
    if (other == [WebSocketResponseMessage defaultInstance]) {
        return self;
    }
    if (other.hasId) {
        [self setId:other.id];
    }
    if (other.hasStatus) {
        [self setStatus:other.status];
    }
    if (other.hasMessage) {
        [self setMessage:other.message];
    }
    if (other.hasBody) {
        [self setBody:other.body];
    }
    [self mergeUnknownFields:other.unknownFields];
    return self;
}
- (WebSocketResponseMessageBuilder *)mergeFromCodedInputStream:(PBCodedInputStream *)input {
    return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]];
}
- (WebSocketResponseMessageBuilder *)mergeFromCodedInputStream:(PBCodedInputStream *)input
                                             extensionRegistry:(PBExtensionRegistry *)extensionRegistry {
    PBUnknownFieldSetBuilder *unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields];
    while (YES) {
        SInt32 tag = [input readTag];
        switch (tag) {
            case 0:
                [self setUnknownFields:[unknownFields build]];
                return self;
            default: {
                if (![self parseUnknownField:input
                               unknownFields:unknownFields
                           extensionRegistry:extensionRegistry
                                         tag:tag]) {
                    [self setUnknownFields:[unknownFields build]];
                    return self;
                }
                break;
            }
            case 8: {
                [self setId:[input readUInt64]];
                break;
            }
            case 16: {
                [self setStatus:[input readUInt32]];
                break;
            }
            case 26: {
                [self setMessage:[input readString]];
                break;
            }
            case 34: {
                [self setBody:[input readData]];
                break;
            }
        }
    }
}
- (BOOL)hasId {
    return result.hasId;
}
- (UInt64)id {
    return result.id;
}
- (WebSocketResponseMessageBuilder *)setId:(UInt64)value {
    result.hasId = YES;
    result.id    = value;
    return self;
}
- (WebSocketResponseMessageBuilder *)clearId {
    result.hasId = NO;
    result.id    = 0L;
    return self;
}
- (BOOL)hasStatus {
    return result.hasStatus;
}
- (UInt32)status {
    return result.status;
}
- (WebSocketResponseMessageBuilder *)setStatus:(UInt32)value {
    result.hasStatus = YES;
    result.status    = value;
    return self;
}
- (WebSocketResponseMessageBuilder *)clearStatus {
    result.hasStatus = NO;
    result.status    = 0;
    return self;
}
- (BOOL)hasMessage {
    return result.hasMessage;
}
- (NSString *)message {
    return result.message;
}
- (WebSocketResponseMessageBuilder *)setMessage:(NSString *)value {
    result.hasMessage = YES;
    result.message    = value;
    return self;
}
- (WebSocketResponseMessageBuilder *)clearMessage {
    result.hasMessage = NO;
    result.message    = @"";
    return self;
}
- (BOOL)hasBody {
    return result.hasBody;
}
- (NSData *)body {
    return result.body;
}
- (WebSocketResponseMessageBuilder *)setBody:(NSData *)value {
    result.hasBody = YES;
    result.body    = value;
    return self;
}
- (WebSocketResponseMessageBuilder *)clearBody {
    result.hasBody = NO;
    result.body    = [NSData data];
    return self;
}
@end

@interface WebSocketMessage ()
@property WebSocketMessageType type;
@property (strong) WebSocketRequestMessage *request;
@property (strong) WebSocketResponseMessage *response;
@end

@implementation WebSocketMessage

- (BOOL)hasType {
    return !!hasType_;
}
- (void)setHasType:(BOOL)value_ {
    hasType_ = !!value_;
}
@synthesize type;
- (BOOL)hasRequest {
    return !!hasRequest_;
}
- (void)setHasRequest:(BOOL)value_ {
    hasRequest_ = !!value_;
}
@synthesize request;
- (BOOL)hasResponse {
    return !!hasResponse_;
}
- (void)setHasResponse:(BOOL)value_ {
    hasResponse_ = !!value_;
}
@synthesize response;
- (id)init {
    if ((self = [super init])) {
        self.type     = WebSocketMessageTypeUnknown;
        self.request  = [WebSocketRequestMessage defaultInstance];
        self.response = [WebSocketResponseMessage defaultInstance];
    }
    return self;
}
static WebSocketMessage *defaultWebSocketMessageInstance = nil;
+ (void)initialize {
    if (self == [WebSocketMessage class]) {
        defaultWebSocketMessageInstance = [[WebSocketMessage alloc] init];
    }
}
+ (WebSocketMessage *)defaultInstance {
    return defaultWebSocketMessageInstance;
}
- (WebSocketMessage *)defaultInstance {
    return defaultWebSocketMessageInstance;
}
- (BOOL)isInitialized {
    return YES;
}
- (void)writeToCodedOutputStream:(PBCodedOutputStream *)output {
    if (self.hasType) {
        [output writeEnum:1 value:self.type];
    }
    if (self.hasRequest) {
        [output writeMessage:2 value:self.request];
    }
    if (self.hasResponse) {
        [output writeMessage:3 value:self.response];
    }
    [self.unknownFields writeToCodedOutputStream:output];
}
- (SInt32)serializedSize {
    __block SInt32 size_ = memoizedSerializedSize;
    if (size_ != -1) {
        return size_;
    }

    size_ = 0;
    if (self.hasType) {
        size_ += computeEnumSize(1, self.type);
    }
    if (self.hasRequest) {
        size_ += computeMessageSize(2, self.request);
    }
    if (self.hasResponse) {
        size_ += computeMessageSize(3, self.response);
    }
    size_ += self.unknownFields.serializedSize;
    memoizedSerializedSize = size_;
    return size_;
}
+ (WebSocketMessage *)parseFromData:(NSData *)data {
    return (WebSocketMessage *)[[[WebSocketMessage builder] mergeFromData:data] build];
}
+ (WebSocketMessage *)parseFromData:(NSData *)data extensionRegistry:(PBExtensionRegistry *)extensionRegistry {
    return (WebSocketMessage *)[[[WebSocketMessage builder] mergeFromData:data extensionRegistry:extensionRegistry]
        build];
}
+ (WebSocketMessage *)parseFromInputStream:(NSInputStream *)input {
    return (WebSocketMessage *)[[[WebSocketMessage builder] mergeFromInputStream:input] build];
}
+ (WebSocketMessage *)parseFromInputStream:(NSInputStream *)input
                         extensionRegistry:(PBExtensionRegistry *)extensionRegistry {
    return (WebSocketMessage *)[
        [[WebSocketMessage builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build];
}
+ (WebSocketMessage *)parseFromCodedInputStream:(PBCodedInputStream *)input {
    return (WebSocketMessage *)[[[WebSocketMessage builder] mergeFromCodedInputStream:input] build];
}
+ (WebSocketMessage *)parseFromCodedInputStream:(PBCodedInputStream *)input
                              extensionRegistry:(PBExtensionRegistry *)extensionRegistry {
    return (WebSocketMessage *)[
        [[WebSocketMessage builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build];
}
+ (WebSocketMessageBuilder *)builder {
    return [[WebSocketMessageBuilder alloc] init];
}
+ (WebSocketMessageBuilder *)builderWithPrototype:(WebSocketMessage *)prototype {
    return [[WebSocketMessage builder] mergeFrom:prototype];
}
- (WebSocketMessageBuilder *)builder {
    return [WebSocketMessage builder];
}
- (WebSocketMessageBuilder *)toBuilder {
    return [WebSocketMessage builderWithPrototype:self];
}
- (void)writeDescriptionTo:(NSMutableString *)output withIndent:(NSString *)indent {
    if (self.hasType) {
        [output appendFormat:@"%@%@: %d\n", indent, @"type", self.type];
    }
    if (self.hasRequest) {
        [output appendFormat:@"%@%@ {\n", indent, @"request"];
        [self.request writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@  ", indent]];
        [output appendFormat:@"%@}\n", indent];
    }
    if (self.hasResponse) {
        [output appendFormat:@"%@%@ {\n", indent, @"response"];
        [self.response writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@  ", indent]];
        [output appendFormat:@"%@}\n", indent];
    }
    [self.unknownFields writeDescriptionTo:output withIndent:indent];
}
- (BOOL)isEqual:(id)other {
    if (other == self) {
        return YES;
    }
    if (![other isKindOfClass:[WebSocketMessage class]]) {
        return NO;
    }
    WebSocketMessage *otherMessage = other;
    return self.hasType == otherMessage.hasType && (!self.hasType || self.type == otherMessage.type) &&
           self.hasRequest == otherMessage.hasRequest &&
           (!self.hasRequest || [self.request isEqual:otherMessage.request]) &&
           self.hasResponse == otherMessage.hasResponse &&
           (!self.hasResponse || [self.response isEqual:otherMessage.response]) &&
           (self.unknownFields == otherMessage.unknownFields ||
            (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields]));
}
- (NSUInteger)hash {
    __block NSUInteger hashCode = 7;
    if (self.hasType) {
        hashCode = hashCode * 31 + self.type;
    }
    if (self.hasRequest) {
        hashCode = hashCode * 31 + [self.request hash];
    }
    if (self.hasResponse) {
        hashCode = hashCode * 31 + [self.response hash];
    }
    hashCode = hashCode * 31 + [self.unknownFields hash];
    return hashCode;
}
@end

BOOL WebSocketMessageTypeIsValidValue(WebSocketMessageType value) {
    switch (value) {
        case WebSocketMessageTypeUnknown:
        case WebSocketMessageTypeRequest:
        case WebSocketMessageTypeResponse:
            return YES;
        default:
            return NO;
    }
}
@interface WebSocketMessageBuilder ()
@property (strong) WebSocketMessage *result;
@end

@implementation WebSocketMessageBuilder
@synthesize result;
- (id)init {
    if ((self = [super init])) {
        self.result = [[WebSocketMessage alloc] init];
    }
    return self;
}
- (PBGeneratedMessage *)internalGetResult {
    return result;
}
- (WebSocketMessageBuilder *)clear {
    self.result = [[WebSocketMessage alloc] init];
    return self;
}
- (WebSocketMessageBuilder *)clone {
    return [WebSocketMessage builderWithPrototype:result];
}
- (WebSocketMessage *)defaultInstance {
    return [WebSocketMessage defaultInstance];
}
- (WebSocketMessage *)build {
    [self checkInitialized];
    return [self buildPartial];
}
- (WebSocketMessage *)buildPartial {
    WebSocketMessage *returnMe = result;
    self.result                = nil;
    return returnMe;
}
- (WebSocketMessageBuilder *)mergeFrom:(WebSocketMessage *)other {
    if (other == [WebSocketMessage defaultInstance]) {
        return self;
    }
    if (other.hasType) {
        [self setType:other.type];
    }
    if (other.hasRequest) {
        [self mergeRequest:other.request];
    }
    if (other.hasResponse) {
        [self mergeResponse:other.response];
    }
    [self mergeUnknownFields:other.unknownFields];
    return self;
}
- (WebSocketMessageBuilder *)mergeFromCodedInputStream:(PBCodedInputStream *)input {
    return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]];
}
- (WebSocketMessageBuilder *)mergeFromCodedInputStream:(PBCodedInputStream *)input
                                     extensionRegistry:(PBExtensionRegistry *)extensionRegistry {
    PBUnknownFieldSetBuilder *unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields];
    while (YES) {
        SInt32 tag = [input readTag];
        switch (tag) {
            case 0:
                [self setUnknownFields:[unknownFields build]];
                return self;
            default: {
                if (![self parseUnknownField:input
                               unknownFields:unknownFields
                           extensionRegistry:extensionRegistry
                                         tag:tag]) {
                    [self setUnknownFields:[unknownFields build]];
                    return self;
                }
                break;
            }
            case 8: {
                WebSocketMessageType value = (WebSocketMessageType)[input readEnum];
                if (WebSocketMessageTypeIsValidValue(value)) {
                    [self setType:value];
                } else {
                    [unknownFields mergeVarintField:1 value:value];
                }
                break;
            }
            case 18: {
                WebSocketRequestMessageBuilder *subBuilder = [WebSocketRequestMessage builder];
                if (self.hasRequest) {
                    [subBuilder mergeFrom:self.request];
                }
                [input readMessage:subBuilder extensionRegistry:extensionRegistry];
                [self setRequest:[subBuilder buildPartial]];
                break;
            }
            case 26: {
                WebSocketResponseMessageBuilder *subBuilder = [WebSocketResponseMessage builder];
                if (self.hasResponse) {
                    [subBuilder mergeFrom:self.response];
                }
                [input readMessage:subBuilder extensionRegistry:extensionRegistry];
                [self setResponse:[subBuilder buildPartial]];
                break;
            }
        }
    }
}
- (BOOL)hasType {
    return result.hasType;
}
- (WebSocketMessageType)type {
    return result.type;
}
- (WebSocketMessageBuilder *)setType:(WebSocketMessageType)value {
    result.hasType = YES;
    result.type    = value;
    return self;
}
- (WebSocketMessageBuilder *)clearType {
    result.hasType = NO;
    result.type    = WebSocketMessageTypeUnknown;
    return self;
}
- (BOOL)hasRequest {
    return result.hasRequest;
}
- (WebSocketRequestMessage *)request {
    return result.request;
}
- (WebSocketMessageBuilder *)setRequest:(WebSocketRequestMessage *)value {
    result.hasRequest = YES;
    result.request    = value;
    return self;
}
- (WebSocketMessageBuilder *)setRequestBuilder:(WebSocketRequestMessageBuilder *)builderForValue {
    return [self setRequest:[builderForValue build]];
}
- (WebSocketMessageBuilder *)mergeRequest:(WebSocketRequestMessage *)value {
    if (result.hasRequest && result.request != [WebSocketRequestMessage defaultInstance]) {
        result.request = [[[WebSocketRequestMessage builderWithPrototype:result.request] mergeFrom:value] buildPartial];
    } else {
        result.request = value;
    }
    result.hasRequest = YES;
    return self;
}
- (WebSocketMessageBuilder *)clearRequest {
    result.hasRequest = NO;
    result.request    = [WebSocketRequestMessage defaultInstance];
    return self;
}
- (BOOL)hasResponse {
    return result.hasResponse;
}
- (WebSocketResponseMessage *)response {
    return result.response;
}
- (WebSocketMessageBuilder *)setResponse:(WebSocketResponseMessage *)value {
    result.hasResponse = YES;
    result.response    = value;
    return self;
}
- (WebSocketMessageBuilder *)setResponseBuilder:(WebSocketResponseMessageBuilder *)builderForValue {
    return [self setResponse:[builderForValue build]];
}
- (WebSocketMessageBuilder *)mergeResponse:(WebSocketResponseMessage *)value {
    if (result.hasResponse && result.response != [WebSocketResponseMessage defaultInstance]) {
        result.response =
            [[[WebSocketResponseMessage builderWithPrototype:result.response] mergeFrom:value] buildPartial];
    } else {
        result.response = value;
    }
    result.hasResponse = YES;
    return self;
}
- (WebSocketMessageBuilder *)clearResponse {
    result.hasResponse = NO;
    result.response    = [WebSocketResponseMessage defaultInstance];
    return self;
}
@end


// @@protoc_insertion_point(global_scope)
