// 
// 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.UninitializedMessageException;
import com.google.protobuf.AbstractParser;
import com.google.protobuf.RuntimeVersion;
import com.google.protobuf.MessageLite;
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.CodedOutputStream;
import com.google.protobuf.Descriptors;
import com.google.protobuf.Parser;
import com.google.protobuf.ByteString;
import com.google.protobuf.GeneratedMessage;

public final class XChaCha20Poly1305Key extends GeneratedMessage implements XChaCha20Poly1305KeyOrBuilder
{
    private static final long serialVersionUID = 0L;
    public static final int VERSION_FIELD_NUMBER = 1;
    private int version_;
    public static final int KEY_VALUE_FIELD_NUMBER = 3;
    private ByteString keyValue_;
    private byte memoizedIsInitialized;
    private static final XChaCha20Poly1305Key DEFAULT_INSTANCE;
    private static final Parser<XChaCha20Poly1305Key> PARSER;
    
    private XChaCha20Poly1305Key(final GeneratedMessage.Builder<?> builder) {
        super(builder);
        this.version_ = 0;
        this.keyValue_ = ByteString.EMPTY;
        this.memoizedIsInitialized = -1;
    }
    
    private XChaCha20Poly1305Key() {
        this.version_ = 0;
        this.keyValue_ = ByteString.EMPTY;
        this.memoizedIsInitialized = -1;
        this.keyValue_ = ByteString.EMPTY;
    }
    
    public static final Descriptors.Descriptor getDescriptor() {
        return Xchacha20Poly1305.internal_static_google_crypto_tink_XChaCha20Poly1305Key_descriptor;
    }
    
    @Override
    protected FieldAccessorTable internalGetFieldAccessorTable() {
        return Xchacha20Poly1305.internal_static_google_crypto_tink_XChaCha20Poly1305Key_fieldAccessorTable.ensureFieldAccessorsInitialized(XChaCha20Poly1305Key.class, Builder.class);
    }
    
    @Override
    public int getVersion() {
        return this.version_;
    }
    
    @Override
    public ByteString getKeyValue() {
        return this.keyValue_;
    }
    
    @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.version_ != 0) {
            output.writeUInt32(1, this.version_);
        }
        if (!this.keyValue_.isEmpty()) {
            output.writeBytes(3, this.keyValue_);
        }
        this.getUnknownFields().writeTo(output);
    }
    
    @Override
    public int getSerializedSize() {
        int size = this.memoizedSize;
        if (size != -1) {
            return size;
        }
        size = 0;
        if (this.version_ != 0) {
            size += CodedOutputStream.computeUInt32Size(1, this.version_);
        }
        if (!this.keyValue_.isEmpty()) {
            size += CodedOutputStream.computeBytesSize(3, this.keyValue_);
        }
        size += this.getUnknownFields().getSerializedSize();
        return this.memoizedSize = size;
    }
    
    @Override
    public boolean equals(final Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof XChaCha20Poly1305Key)) {
            return super.equals(obj);
        }
        final XChaCha20Poly1305Key other = (XChaCha20Poly1305Key)obj;
        return this.getVersion() == other.getVersion() && this.getKeyValue().equals(other.getKeyValue()) && 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 + 1;
        hash = 53 * hash + this.getVersion();
        hash = 37 * hash + 3;
        hash = 53 * hash + this.getKeyValue().hashCode();
        hash = 29 * hash + this.getUnknownFields().hashCode();
        return this.memoizedHashCode = hash;
    }
    
    public static XChaCha20Poly1305Key parseFrom(final ByteBuffer data) throws InvalidProtocolBufferException {
        return XChaCha20Poly1305Key.PARSER.parseFrom(data);
    }
    
    public static XChaCha20Poly1305Key parseFrom(final ByteBuffer data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return XChaCha20Poly1305Key.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static XChaCha20Poly1305Key parseFrom(final ByteString data) throws InvalidProtocolBufferException {
        return XChaCha20Poly1305Key.PARSER.parseFrom(data);
    }
    
    public static XChaCha20Poly1305Key parseFrom(final ByteString data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return XChaCha20Poly1305Key.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static XChaCha20Poly1305Key parseFrom(final byte[] data) throws InvalidProtocolBufferException {
        return XChaCha20Poly1305Key.PARSER.parseFrom(data);
    }
    
    public static XChaCha20Poly1305Key parseFrom(final byte[] data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return XChaCha20Poly1305Key.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static XChaCha20Poly1305Key parseFrom(final InputStream input) throws IOException {
        return GeneratedMessage.parseWithIOException(XChaCha20Poly1305Key.PARSER, input);
    }
    
    public static XChaCha20Poly1305Key parseFrom(final InputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseWithIOException(XChaCha20Poly1305Key.PARSER, input, extensionRegistry);
    }
    
    public static XChaCha20Poly1305Key parseDelimitedFrom(final InputStream input) throws IOException {
        return GeneratedMessage.parseDelimitedWithIOException(XChaCha20Poly1305Key.PARSER, input);
    }
    
    public static XChaCha20Poly1305Key parseDelimitedFrom(final InputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseDelimitedWithIOException(XChaCha20Poly1305Key.PARSER, input, extensionRegistry);
    }
    
    public static XChaCha20Poly1305Key parseFrom(final CodedInputStream input) throws IOException {
        return GeneratedMessage.parseWithIOException(XChaCha20Poly1305Key.PARSER, input);
    }
    
    public static XChaCha20Poly1305Key parseFrom(final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseWithIOException(XChaCha20Poly1305Key.PARSER, input, extensionRegistry);
    }
    
    @Override
    public Builder newBuilderForType() {
        return newBuilder();
    }
    
    public static Builder newBuilder() {
        return XChaCha20Poly1305Key.DEFAULT_INSTANCE.toBuilder();
    }
    
    public static Builder newBuilder(final XChaCha20Poly1305Key prototype) {
        return XChaCha20Poly1305Key.DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }
    
    @Override
    public Builder toBuilder() {
        return (this == XChaCha20Poly1305Key.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 XChaCha20Poly1305Key getDefaultInstance() {
        return XChaCha20Poly1305Key.DEFAULT_INSTANCE;
    }
    
    public static Parser<XChaCha20Poly1305Key> parser() {
        return XChaCha20Poly1305Key.PARSER;
    }
    
    @Override
    public Parser<XChaCha20Poly1305Key> getParserForType() {
        return XChaCha20Poly1305Key.PARSER;
    }
    
    @Override
    public XChaCha20Poly1305Key getDefaultInstanceForType() {
        return XChaCha20Poly1305Key.DEFAULT_INSTANCE;
    }
    
    static {
        RuntimeVersion.validateProtobufGencodeVersion(RuntimeVersion.RuntimeDomain.PUBLIC, 4, 32, 1, "", XChaCha20Poly1305Key.class.getName());
        DEFAULT_INSTANCE = new XChaCha20Poly1305Key();
        PARSER = new AbstractParser<XChaCha20Poly1305Key>() {
            @Override
            public XChaCha20Poly1305Key parsePartialFrom(final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
                final Builder builder = XChaCha20Poly1305Key.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 XChaCha20Poly1305KeyOrBuilder
    {
        private int bitField0_;
        private int version_;
        private ByteString keyValue_;
        
        public static final Descriptors.Descriptor getDescriptor() {
            return Xchacha20Poly1305.internal_static_google_crypto_tink_XChaCha20Poly1305Key_descriptor;
        }
        
        @Override
        protected FieldAccessorTable internalGetFieldAccessorTable() {
            return Xchacha20Poly1305.internal_static_google_crypto_tink_XChaCha20Poly1305Key_fieldAccessorTable.ensureFieldAccessorsInitialized(XChaCha20Poly1305Key.class, Builder.class);
        }
        
        private Builder() {
            this.keyValue_ = ByteString.EMPTY;
        }
        
        private Builder(final BuilderParent parent) {
            super(parent);
            this.keyValue_ = ByteString.EMPTY;
        }
        
        @Override
        public Builder clear() {
            super.clear();
            this.bitField0_ = 0;
            this.version_ = 0;
            this.keyValue_ = ByteString.EMPTY;
            return this;
        }
        
        @Override
        public Descriptors.Descriptor getDescriptorForType() {
            return Xchacha20Poly1305.internal_static_google_crypto_tink_XChaCha20Poly1305Key_descriptor;
        }
        
        @Override
        public XChaCha20Poly1305Key getDefaultInstanceForType() {
            return XChaCha20Poly1305Key.getDefaultInstance();
        }
        
        @Override
        public XChaCha20Poly1305Key build() {
            final XChaCha20Poly1305Key result = this.buildPartial();
            if (!result.isInitialized()) {
                throw AbstractMessage.Builder.newUninitializedMessageException(result);
            }
            return result;
        }
        
        @Override
        public XChaCha20Poly1305Key buildPartial() {
            final XChaCha20Poly1305Key result = new XChaCha20Poly1305Key(this, null);
            if (this.bitField0_ != 0) {
                this.buildPartial0(result);
            }
            this.onBuilt();
            return result;
        }
        
        private void buildPartial0(final XChaCha20Poly1305Key result) {
            final int from_bitField0_ = this.bitField0_;
            if ((from_bitField0_ & 0x1) != 0x0) {
                result.version_ = this.version_;
            }
            if ((from_bitField0_ & 0x2) != 0x0) {
                result.keyValue_ = this.keyValue_;
            }
        }
        
        @Override
        public Builder mergeFrom(final Message other) {
            if (other instanceof XChaCha20Poly1305Key) {
                return this.mergeFrom((XChaCha20Poly1305Key)other);
            }
            super.mergeFrom(other);
            return this;
        }
        
        public Builder mergeFrom(final XChaCha20Poly1305Key other) {
            if (other == XChaCha20Poly1305Key.getDefaultInstance()) {
                return this;
            }
            if (other.getVersion() != 0) {
                this.setVersion(other.getVersion());
            }
            if (!other.getKeyValue().isEmpty()) {
                this.setKeyValue(other.getKeyValue());
            }
            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 8: {
                            this.version_ = input.readUInt32();
                            this.bitField0_ |= 0x1;
                            continue;
                        }
                        case 26: {
                            this.keyValue_ = input.readBytes();
                            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 int getVersion() {
            return this.version_;
        }
        
        public Builder setVersion(final int value) {
            this.version_ = value;
            this.bitField0_ |= 0x1;
            this.onChanged();
            return this;
        }
        
        public Builder clearVersion() {
            this.bitField0_ &= 0xFFFFFFFE;
            this.version_ = 0;
            this.onChanged();
            return this;
        }
        
        @Override
        public ByteString getKeyValue() {
            return this.keyValue_;
        }
        
        public Builder setKeyValue(final ByteString value) {
            if (value == null) {
                throw new NullPointerException();
            }
            this.keyValue_ = value;
            this.bitField0_ |= 0x2;
            this.onChanged();
            return this;
        }
        
        public Builder clearKeyValue() {
            this.bitField0_ &= 0xFFFFFFFD;
            this.keyValue_ = XChaCha20Poly1305Key.getDefaultInstance().getKeyValue();
            this.onChanged();
            return this;
        }
    }
}
