// 
// Decompiled by Procyon v0.6.0
// 

package com.google.crypto.tink.proto;

import com.google.protobuf.AbstractMessageLite;
import com.google.protobuf.UnknownFieldSet;
import com.google.protobuf.SingleFieldBuilder;
import com.google.protobuf.UninitializedMessageException;
import com.google.protobuf.AbstractParser;
import com.google.protobuf.RuntimeVersion;
import com.google.protobuf.Message;
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.CodedInputStream;
import java.io.InputStream;
import com.google.protobuf.ExtensionRegistryLite;
import com.google.protobuf.InvalidProtocolBufferException;
import java.nio.ByteBuffer;
import java.io.IOException;
import com.google.protobuf.MessageLite;
import com.google.protobuf.CodedOutputStream;
import com.google.protobuf.Descriptors;
import com.google.protobuf.Parser;
import com.google.protobuf.ByteString;
import com.google.protobuf.GeneratedMessage;

public final class EncryptedKeyset extends GeneratedMessage implements EncryptedKeysetOrBuilder
{
    private static final long serialVersionUID = 0L;
    private int bitField0_;
    public static final int ENCRYPTED_KEYSET_FIELD_NUMBER = 2;
    private ByteString encryptedKeyset_;
    public static final int KEYSET_INFO_FIELD_NUMBER = 3;
    private KeysetInfo keysetInfo_;
    private byte memoizedIsInitialized;
    private static final EncryptedKeyset DEFAULT_INSTANCE;
    private static final Parser<EncryptedKeyset> PARSER;
    
    private EncryptedKeyset(final GeneratedMessage.Builder<?> builder) {
        super(builder);
        this.encryptedKeyset_ = ByteString.EMPTY;
        this.memoizedIsInitialized = -1;
    }
    
    private EncryptedKeyset() {
        this.encryptedKeyset_ = ByteString.EMPTY;
        this.memoizedIsInitialized = -1;
        this.encryptedKeyset_ = ByteString.EMPTY;
    }
    
    public static final Descriptors.Descriptor getDescriptor() {
        return Tink.internal_static_google_crypto_tink_EncryptedKeyset_descriptor;
    }
    
    @Override
    protected FieldAccessorTable internalGetFieldAccessorTable() {
        return Tink.internal_static_google_crypto_tink_EncryptedKeyset_fieldAccessorTable.ensureFieldAccessorsInitialized(EncryptedKeyset.class, Builder.class);
    }
    
    @Override
    public ByteString getEncryptedKeyset() {
        return this.encryptedKeyset_;
    }
    
    @Override
    public boolean hasKeysetInfo() {
        return (this.bitField0_ & 0x1) != 0x0;
    }
    
    @Override
    public KeysetInfo getKeysetInfo() {
        return (this.keysetInfo_ == null) ? KeysetInfo.getDefaultInstance() : this.keysetInfo_;
    }
    
    @Override
    public KeysetInfoOrBuilder getKeysetInfoOrBuilder() {
        return (this.keysetInfo_ == null) ? KeysetInfo.getDefaultInstance() : this.keysetInfo_;
    }
    
    @Override
    public final boolean isInitialized() {
        final byte isInitialized = this.memoizedIsInitialized;
        if (isInitialized == 1) {
            return true;
        }
        if (isInitialized == 0) {
            return false;
        }
        this.memoizedIsInitialized = 1;
        return true;
    }
    
    @Override
    public void writeTo(final CodedOutputStream output) throws IOException {
        if (!this.encryptedKeyset_.isEmpty()) {
            output.writeBytes(2, this.encryptedKeyset_);
        }
        if ((this.bitField0_ & 0x1) != 0x0) {
            output.writeMessage(3, this.getKeysetInfo());
        }
        this.getUnknownFields().writeTo(output);
    }
    
    @Override
    public int getSerializedSize() {
        int size = this.memoizedSize;
        if (size != -1) {
            return size;
        }
        size = 0;
        if (!this.encryptedKeyset_.isEmpty()) {
            size += CodedOutputStream.computeBytesSize(2, this.encryptedKeyset_);
        }
        if ((this.bitField0_ & 0x1) != 0x0) {
            size += CodedOutputStream.computeMessageSize(3, this.getKeysetInfo());
        }
        size += this.getUnknownFields().getSerializedSize();
        return this.memoizedSize = size;
    }
    
    @Override
    public boolean equals(final Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof EncryptedKeyset)) {
            return super.equals(obj);
        }
        final EncryptedKeyset other = (EncryptedKeyset)obj;
        return this.getEncryptedKeyset().equals(other.getEncryptedKeyset()) && this.hasKeysetInfo() == other.hasKeysetInfo() && (!this.hasKeysetInfo() || this.getKeysetInfo().equals(other.getKeysetInfo())) && this.getUnknownFields().equals(other.getUnknownFields());
    }
    
    @Override
    public int hashCode() {
        if (this.memoizedHashCode != 0) {
            return this.memoizedHashCode;
        }
        int hash = 41;
        hash = 19 * hash + getDescriptor().hashCode();
        hash = 37 * hash + 2;
        hash = 53 * hash + this.getEncryptedKeyset().hashCode();
        if (this.hasKeysetInfo()) {
            hash = 37 * hash + 3;
            hash = 53 * hash + this.getKeysetInfo().hashCode();
        }
        hash = 29 * hash + this.getUnknownFields().hashCode();
        return this.memoizedHashCode = hash;
    }
    
    public static EncryptedKeyset parseFrom(final ByteBuffer data) throws InvalidProtocolBufferException {
        return EncryptedKeyset.PARSER.parseFrom(data);
    }
    
    public static EncryptedKeyset parseFrom(final ByteBuffer data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return EncryptedKeyset.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static EncryptedKeyset parseFrom(final ByteString data) throws InvalidProtocolBufferException {
        return EncryptedKeyset.PARSER.parseFrom(data);
    }
    
    public static EncryptedKeyset parseFrom(final ByteString data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return EncryptedKeyset.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static EncryptedKeyset parseFrom(final byte[] data) throws InvalidProtocolBufferException {
        return EncryptedKeyset.PARSER.parseFrom(data);
    }
    
    public static EncryptedKeyset parseFrom(final byte[] data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return EncryptedKeyset.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static EncryptedKeyset parseFrom(final InputStream input) throws IOException {
        return GeneratedMessage.parseWithIOException(EncryptedKeyset.PARSER, input);
    }
    
    public static EncryptedKeyset parseFrom(final InputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseWithIOException(EncryptedKeyset.PARSER, input, extensionRegistry);
    }
    
    public static EncryptedKeyset parseDelimitedFrom(final InputStream input) throws IOException {
        return GeneratedMessage.parseDelimitedWithIOException(EncryptedKeyset.PARSER, input);
    }
    
    public static EncryptedKeyset parseDelimitedFrom(final InputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseDelimitedWithIOException(EncryptedKeyset.PARSER, input, extensionRegistry);
    }
    
    public static EncryptedKeyset parseFrom(final CodedInputStream input) throws IOException {
        return GeneratedMessage.parseWithIOException(EncryptedKeyset.PARSER, input);
    }
    
    public static EncryptedKeyset parseFrom(final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseWithIOException(EncryptedKeyset.PARSER, input, extensionRegistry);
    }
    
    @Override
    public Builder newBuilderForType() {
        return newBuilder();
    }
    
    public static Builder newBuilder() {
        return EncryptedKeyset.DEFAULT_INSTANCE.toBuilder();
    }
    
    public static Builder newBuilder(final EncryptedKeyset prototype) {
        return EncryptedKeyset.DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }
    
    @Override
    public Builder toBuilder() {
        return (this == EncryptedKeyset.DEFAULT_INSTANCE) ? new Builder() : new Builder().mergeFrom(this);
    }
    
    @Override
    protected Builder newBuilderForType(final BuilderParent parent) {
        final Builder builder = new Builder(parent);
        return builder;
    }
    
    public static EncryptedKeyset getDefaultInstance() {
        return EncryptedKeyset.DEFAULT_INSTANCE;
    }
    
    public static Parser<EncryptedKeyset> parser() {
        return EncryptedKeyset.PARSER;
    }
    
    @Override
    public Parser<EncryptedKeyset> getParserForType() {
        return EncryptedKeyset.PARSER;
    }
    
    @Override
    public EncryptedKeyset getDefaultInstanceForType() {
        return EncryptedKeyset.DEFAULT_INSTANCE;
    }
    
    static {
        RuntimeVersion.validateProtobufGencodeVersion(RuntimeVersion.RuntimeDomain.PUBLIC, 4, 32, 1, "", EncryptedKeyset.class.getName());
        DEFAULT_INSTANCE = new EncryptedKeyset();
        PARSER = new AbstractParser<EncryptedKeyset>() {
            @Override
            public EncryptedKeyset parsePartialFrom(final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
                final Builder builder = EncryptedKeyset.newBuilder();
                try {
                    builder.mergeFrom(input, extensionRegistry);
                }
                catch (final InvalidProtocolBufferException e) {
                    throw e.setUnfinishedMessage(builder.buildPartial());
                }
                catch (final UninitializedMessageException e2) {
                    throw e2.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
                }
                catch (final IOException e3) {
                    throw new InvalidProtocolBufferException(e3).setUnfinishedMessage(builder.buildPartial());
                }
                return builder.buildPartial();
            }
        };
    }
    
    public static final class Builder extends GeneratedMessage.Builder<Builder> implements EncryptedKeysetOrBuilder
    {
        private int bitField0_;
        private ByteString encryptedKeyset_;
        private KeysetInfo keysetInfo_;
        private SingleFieldBuilder<KeysetInfo, KeysetInfo.Builder, KeysetInfoOrBuilder> keysetInfoBuilder_;
        
        public static final Descriptors.Descriptor getDescriptor() {
            return Tink.internal_static_google_crypto_tink_EncryptedKeyset_descriptor;
        }
        
        @Override
        protected FieldAccessorTable internalGetFieldAccessorTable() {
            return Tink.internal_static_google_crypto_tink_EncryptedKeyset_fieldAccessorTable.ensureFieldAccessorsInitialized(EncryptedKeyset.class, Builder.class);
        }
        
        private Builder() {
            this.encryptedKeyset_ = ByteString.EMPTY;
            this.maybeForceBuilderInitialization();
        }
        
        private Builder(final BuilderParent parent) {
            super(parent);
            this.encryptedKeyset_ = ByteString.EMPTY;
            this.maybeForceBuilderInitialization();
        }
        
        private void maybeForceBuilderInitialization() {
            if (EncryptedKeyset.alwaysUseFieldBuilders) {
                this.internalGetKeysetInfoFieldBuilder();
            }
        }
        
        @Override
        public Builder clear() {
            super.clear();
            this.bitField0_ = 0;
            this.encryptedKeyset_ = ByteString.EMPTY;
            this.keysetInfo_ = null;
            if (this.keysetInfoBuilder_ != null) {
                this.keysetInfoBuilder_.dispose();
                this.keysetInfoBuilder_ = null;
            }
            return this;
        }
        
        @Override
        public Descriptors.Descriptor getDescriptorForType() {
            return Tink.internal_static_google_crypto_tink_EncryptedKeyset_descriptor;
        }
        
        @Override
        public EncryptedKeyset getDefaultInstanceForType() {
            return EncryptedKeyset.getDefaultInstance();
        }
        
        @Override
        public EncryptedKeyset build() {
            final EncryptedKeyset result = this.buildPartial();
            if (!result.isInitialized()) {
                throw AbstractMessage.Builder.newUninitializedMessageException(result);
            }
            return result;
        }
        
        @Override
        public EncryptedKeyset buildPartial() {
            final EncryptedKeyset result = new EncryptedKeyset(this, null);
            if (this.bitField0_ != 0) {
                this.buildPartial0(result);
            }
            this.onBuilt();
            return result;
        }
        
        private void buildPartial0(final EncryptedKeyset result) {
            final int from_bitField0_ = this.bitField0_;
            if ((from_bitField0_ & 0x1) != 0x0) {
                result.encryptedKeyset_ = this.encryptedKeyset_;
            }
            int to_bitField0_ = 0;
            if ((from_bitField0_ & 0x2) != 0x0) {
                result.keysetInfo_ = ((this.keysetInfoBuilder_ == null) ? this.keysetInfo_ : this.keysetInfoBuilder_.build());
                to_bitField0_ |= 0x1;
            }
            result.bitField0_ |= to_bitField0_;
        }
        
        @Override
        public Builder mergeFrom(final Message other) {
            if (other instanceof EncryptedKeyset) {
                return this.mergeFrom((EncryptedKeyset)other);
            }
            super.mergeFrom(other);
            return this;
        }
        
        public Builder mergeFrom(final EncryptedKeyset other) {
            if (other == EncryptedKeyset.getDefaultInstance()) {
                return this;
            }
            if (!other.getEncryptedKeyset().isEmpty()) {
                this.setEncryptedKeyset(other.getEncryptedKeyset());
            }
            if (other.hasKeysetInfo()) {
                this.mergeKeysetInfo(other.getKeysetInfo());
            }
            this.mergeUnknownFields(other.getUnknownFields());
            this.onChanged();
            return this;
        }
        
        @Override
        public final boolean isInitialized() {
            return true;
        }
        
        @Override
        public Builder mergeFrom(final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
            if (extensionRegistry == null) {
                throw new NullPointerException();
            }
            try {
                boolean done = false;
                while (!done) {
                    final int tag = input.readTag();
                    switch (tag) {
                        case 0: {
                            done = true;
                            continue;
                        }
                        case 18: {
                            this.encryptedKeyset_ = input.readBytes();
                            this.bitField0_ |= 0x1;
                            continue;
                        }
                        case 26: {
                            input.readMessage(this.internalGetKeysetInfoFieldBuilder().getBuilder(), extensionRegistry);
                            this.bitField0_ |= 0x2;
                            continue;
                        }
                        default: {
                            if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                                done = true;
                                continue;
                            }
                            continue;
                        }
                    }
                }
            }
            catch (final InvalidProtocolBufferException e) {
                throw e.unwrapIOException();
            }
            finally {
                this.onChanged();
            }
            return this;
        }
        
        @Override
        public ByteString getEncryptedKeyset() {
            return this.encryptedKeyset_;
        }
        
        public Builder setEncryptedKeyset(final ByteString value) {
            if (value == null) {
                throw new NullPointerException();
            }
            this.encryptedKeyset_ = value;
            this.bitField0_ |= 0x1;
            this.onChanged();
            return this;
        }
        
        public Builder clearEncryptedKeyset() {
            this.bitField0_ &= 0xFFFFFFFE;
            this.encryptedKeyset_ = EncryptedKeyset.getDefaultInstance().getEncryptedKeyset();
            this.onChanged();
            return this;
        }
        
        @Override
        public boolean hasKeysetInfo() {
            return (this.bitField0_ & 0x2) != 0x0;
        }
        
        @Override
        public KeysetInfo getKeysetInfo() {
            if (this.keysetInfoBuilder_ == null) {
                return (this.keysetInfo_ == null) ? KeysetInfo.getDefaultInstance() : this.keysetInfo_;
            }
            return this.keysetInfoBuilder_.getMessage();
        }
        
        public Builder setKeysetInfo(final KeysetInfo value) {
            if (this.keysetInfoBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                this.keysetInfo_ = value;
            }
            else {
                this.keysetInfoBuilder_.setMessage(value);
            }
            this.bitField0_ |= 0x2;
            this.onChanged();
            return this;
        }
        
        public Builder setKeysetInfo(final KeysetInfo.Builder builderForValue) {
            if (this.keysetInfoBuilder_ == null) {
                this.keysetInfo_ = builderForValue.build();
            }
            else {
                this.keysetInfoBuilder_.setMessage(builderForValue.build());
            }
            this.bitField0_ |= 0x2;
            this.onChanged();
            return this;
        }
        
        public Builder mergeKeysetInfo(final KeysetInfo value) {
            if (this.keysetInfoBuilder_ == null) {
                if ((this.bitField0_ & 0x2) != 0x0 && this.keysetInfo_ != null && this.keysetInfo_ != KeysetInfo.getDefaultInstance()) {
                    this.getKeysetInfoBuilder().mergeFrom(value);
                }
                else {
                    this.keysetInfo_ = value;
                }
            }
            else {
                this.keysetInfoBuilder_.mergeFrom(value);
            }
            if (this.keysetInfo_ != null) {
                this.bitField0_ |= 0x2;
                this.onChanged();
            }
            return this;
        }
        
        public Builder clearKeysetInfo() {
            this.bitField0_ &= 0xFFFFFFFD;
            this.keysetInfo_ = null;
            if (this.keysetInfoBuilder_ != null) {
                this.keysetInfoBuilder_.dispose();
                this.keysetInfoBuilder_ = null;
            }
            this.onChanged();
            return this;
        }
        
        public KeysetInfo.Builder getKeysetInfoBuilder() {
            this.bitField0_ |= 0x2;
            this.onChanged();
            return this.internalGetKeysetInfoFieldBuilder().getBuilder();
        }
        
        @Override
        public KeysetInfoOrBuilder getKeysetInfoOrBuilder() {
            if (this.keysetInfoBuilder_ != null) {
                return this.keysetInfoBuilder_.getMessageOrBuilder();
            }
            return (this.keysetInfo_ == null) ? KeysetInfo.getDefaultInstance() : this.keysetInfo_;
        }
        
        private SingleFieldBuilder<KeysetInfo, KeysetInfo.Builder, KeysetInfoOrBuilder> internalGetKeysetInfoFieldBuilder() {
            if (this.keysetInfoBuilder_ == null) {
                this.keysetInfoBuilder_ = new SingleFieldBuilder<KeysetInfo, KeysetInfo.Builder, KeysetInfoOrBuilder>(this.getKeysetInfo(), this.getParentForChildren(), this.isClean());
                this.keysetInfo_ = null;
            }
            return this.keysetInfoBuilder_;
        }
    }
}
