// 
// 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.ByteString;
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.GeneratedMessage;

public final class AesCtrHmacStreamingParams extends GeneratedMessage implements AesCtrHmacStreamingParamsOrBuilder
{
    private static final long serialVersionUID = 0L;
    private int bitField0_;
    public static final int CIPHERTEXT_SEGMENT_SIZE_FIELD_NUMBER = 1;
    private int ciphertextSegmentSize_;
    public static final int DERIVED_KEY_SIZE_FIELD_NUMBER = 2;
    private int derivedKeySize_;
    public static final int HKDF_HASH_TYPE_FIELD_NUMBER = 3;
    private int hkdfHashType_;
    public static final int HMAC_PARAMS_FIELD_NUMBER = 4;
    private HmacParams hmacParams_;
    private byte memoizedIsInitialized;
    private static final AesCtrHmacStreamingParams DEFAULT_INSTANCE;
    private static final Parser<AesCtrHmacStreamingParams> PARSER;
    
    private AesCtrHmacStreamingParams(final GeneratedMessage.Builder<?> builder) {
        super(builder);
        this.ciphertextSegmentSize_ = 0;
        this.derivedKeySize_ = 0;
        this.hkdfHashType_ = 0;
        this.memoizedIsInitialized = -1;
    }
    
    private AesCtrHmacStreamingParams() {
        this.ciphertextSegmentSize_ = 0;
        this.derivedKeySize_ = 0;
        this.hkdfHashType_ = 0;
        this.memoizedIsInitialized = -1;
        this.hkdfHashType_ = 0;
    }
    
    public static final Descriptors.Descriptor getDescriptor() {
        return AesCtrHmacStreaming.internal_static_google_crypto_tink_AesCtrHmacStreamingParams_descriptor;
    }
    
    @Override
    protected FieldAccessorTable internalGetFieldAccessorTable() {
        return AesCtrHmacStreaming.internal_static_google_crypto_tink_AesCtrHmacStreamingParams_fieldAccessorTable.ensureFieldAccessorsInitialized(AesCtrHmacStreamingParams.class, Builder.class);
    }
    
    @Override
    public int getCiphertextSegmentSize() {
        return this.ciphertextSegmentSize_;
    }
    
    @Override
    public int getDerivedKeySize() {
        return this.derivedKeySize_;
    }
    
    @Override
    public int getHkdfHashTypeValue() {
        return this.hkdfHashType_;
    }
    
    @Override
    public HashType getHkdfHashType() {
        final HashType result = HashType.forNumber(this.hkdfHashType_);
        return (result == null) ? HashType.UNRECOGNIZED : result;
    }
    
    @Override
    public boolean hasHmacParams() {
        return (this.bitField0_ & 0x1) != 0x0;
    }
    
    @Override
    public HmacParams getHmacParams() {
        return (this.hmacParams_ == null) ? HmacParams.getDefaultInstance() : this.hmacParams_;
    }
    
    @Override
    public HmacParamsOrBuilder getHmacParamsOrBuilder() {
        return (this.hmacParams_ == null) ? HmacParams.getDefaultInstance() : this.hmacParams_;
    }
    
    @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.ciphertextSegmentSize_ != 0) {
            output.writeUInt32(1, this.ciphertextSegmentSize_);
        }
        if (this.derivedKeySize_ != 0) {
            output.writeUInt32(2, this.derivedKeySize_);
        }
        if (this.hkdfHashType_ != HashType.UNKNOWN_HASH.getNumber()) {
            output.writeEnum(3, this.hkdfHashType_);
        }
        if ((this.bitField0_ & 0x1) != 0x0) {
            output.writeMessage(4, this.getHmacParams());
        }
        this.getUnknownFields().writeTo(output);
    }
    
    @Override
    public int getSerializedSize() {
        int size = this.memoizedSize;
        if (size != -1) {
            return size;
        }
        size = 0;
        if (this.ciphertextSegmentSize_ != 0) {
            size += CodedOutputStream.computeUInt32Size(1, this.ciphertextSegmentSize_);
        }
        if (this.derivedKeySize_ != 0) {
            size += CodedOutputStream.computeUInt32Size(2, this.derivedKeySize_);
        }
        if (this.hkdfHashType_ != HashType.UNKNOWN_HASH.getNumber()) {
            size += CodedOutputStream.computeEnumSize(3, this.hkdfHashType_);
        }
        if ((this.bitField0_ & 0x1) != 0x0) {
            size += CodedOutputStream.computeMessageSize(4, this.getHmacParams());
        }
        size += this.getUnknownFields().getSerializedSize();
        return this.memoizedSize = size;
    }
    
    @Override
    public boolean equals(final Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof AesCtrHmacStreamingParams)) {
            return super.equals(obj);
        }
        final AesCtrHmacStreamingParams other = (AesCtrHmacStreamingParams)obj;
        return this.getCiphertextSegmentSize() == other.getCiphertextSegmentSize() && this.getDerivedKeySize() == other.getDerivedKeySize() && this.hkdfHashType_ == other.hkdfHashType_ && this.hasHmacParams() == other.hasHmacParams() && (!this.hasHmacParams() || this.getHmacParams().equals(other.getHmacParams())) && 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.getCiphertextSegmentSize();
        hash = 37 * hash + 2;
        hash = 53 * hash + this.getDerivedKeySize();
        hash = 37 * hash + 3;
        hash = 53 * hash + this.hkdfHashType_;
        if (this.hasHmacParams()) {
            hash = 37 * hash + 4;
            hash = 53 * hash + this.getHmacParams().hashCode();
        }
        hash = 29 * hash + this.getUnknownFields().hashCode();
        return this.memoizedHashCode = hash;
    }
    
    public static AesCtrHmacStreamingParams parseFrom(final ByteBuffer data) throws InvalidProtocolBufferException {
        return AesCtrHmacStreamingParams.PARSER.parseFrom(data);
    }
    
    public static AesCtrHmacStreamingParams parseFrom(final ByteBuffer data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return AesCtrHmacStreamingParams.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static AesCtrHmacStreamingParams parseFrom(final ByteString data) throws InvalidProtocolBufferException {
        return AesCtrHmacStreamingParams.PARSER.parseFrom(data);
    }
    
    public static AesCtrHmacStreamingParams parseFrom(final ByteString data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return AesCtrHmacStreamingParams.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static AesCtrHmacStreamingParams parseFrom(final byte[] data) throws InvalidProtocolBufferException {
        return AesCtrHmacStreamingParams.PARSER.parseFrom(data);
    }
    
    public static AesCtrHmacStreamingParams parseFrom(final byte[] data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return AesCtrHmacStreamingParams.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static AesCtrHmacStreamingParams parseFrom(final InputStream input) throws IOException {
        return GeneratedMessage.parseWithIOException(AesCtrHmacStreamingParams.PARSER, input);
    }
    
    public static AesCtrHmacStreamingParams parseFrom(final InputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseWithIOException(AesCtrHmacStreamingParams.PARSER, input, extensionRegistry);
    }
    
    public static AesCtrHmacStreamingParams parseDelimitedFrom(final InputStream input) throws IOException {
        return GeneratedMessage.parseDelimitedWithIOException(AesCtrHmacStreamingParams.PARSER, input);
    }
    
    public static AesCtrHmacStreamingParams parseDelimitedFrom(final InputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseDelimitedWithIOException(AesCtrHmacStreamingParams.PARSER, input, extensionRegistry);
    }
    
    public static AesCtrHmacStreamingParams parseFrom(final CodedInputStream input) throws IOException {
        return GeneratedMessage.parseWithIOException(AesCtrHmacStreamingParams.PARSER, input);
    }
    
    public static AesCtrHmacStreamingParams parseFrom(final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseWithIOException(AesCtrHmacStreamingParams.PARSER, input, extensionRegistry);
    }
    
    @Override
    public Builder newBuilderForType() {
        return newBuilder();
    }
    
    public static Builder newBuilder() {
        return AesCtrHmacStreamingParams.DEFAULT_INSTANCE.toBuilder();
    }
    
    public static Builder newBuilder(final AesCtrHmacStreamingParams prototype) {
        return AesCtrHmacStreamingParams.DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }
    
    @Override
    public Builder toBuilder() {
        return (this == AesCtrHmacStreamingParams.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 AesCtrHmacStreamingParams getDefaultInstance() {
        return AesCtrHmacStreamingParams.DEFAULT_INSTANCE;
    }
    
    public static Parser<AesCtrHmacStreamingParams> parser() {
        return AesCtrHmacStreamingParams.PARSER;
    }
    
    @Override
    public Parser<AesCtrHmacStreamingParams> getParserForType() {
        return AesCtrHmacStreamingParams.PARSER;
    }
    
    @Override
    public AesCtrHmacStreamingParams getDefaultInstanceForType() {
        return AesCtrHmacStreamingParams.DEFAULT_INSTANCE;
    }
    
    static {
        RuntimeVersion.validateProtobufGencodeVersion(RuntimeVersion.RuntimeDomain.PUBLIC, 4, 32, 1, "", AesCtrHmacStreamingParams.class.getName());
        DEFAULT_INSTANCE = new AesCtrHmacStreamingParams();
        PARSER = new AbstractParser<AesCtrHmacStreamingParams>() {
            @Override
            public AesCtrHmacStreamingParams parsePartialFrom(final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
                final Builder builder = AesCtrHmacStreamingParams.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 AesCtrHmacStreamingParamsOrBuilder
    {
        private int bitField0_;
        private int ciphertextSegmentSize_;
        private int derivedKeySize_;
        private int hkdfHashType_;
        private HmacParams hmacParams_;
        private SingleFieldBuilder<HmacParams, HmacParams.Builder, HmacParamsOrBuilder> hmacParamsBuilder_;
        
        public static final Descriptors.Descriptor getDescriptor() {
            return AesCtrHmacStreaming.internal_static_google_crypto_tink_AesCtrHmacStreamingParams_descriptor;
        }
        
        @Override
        protected FieldAccessorTable internalGetFieldAccessorTable() {
            return AesCtrHmacStreaming.internal_static_google_crypto_tink_AesCtrHmacStreamingParams_fieldAccessorTable.ensureFieldAccessorsInitialized(AesCtrHmacStreamingParams.class, Builder.class);
        }
        
        private Builder() {
            this.hkdfHashType_ = 0;
            this.maybeForceBuilderInitialization();
        }
        
        private Builder(final BuilderParent parent) {
            super(parent);
            this.hkdfHashType_ = 0;
            this.maybeForceBuilderInitialization();
        }
        
        private void maybeForceBuilderInitialization() {
            if (AesCtrHmacStreamingParams.alwaysUseFieldBuilders) {
                this.internalGetHmacParamsFieldBuilder();
            }
        }
        
        @Override
        public Builder clear() {
            super.clear();
            this.bitField0_ = 0;
            this.ciphertextSegmentSize_ = 0;
            this.derivedKeySize_ = 0;
            this.hkdfHashType_ = 0;
            this.hmacParams_ = null;
            if (this.hmacParamsBuilder_ != null) {
                this.hmacParamsBuilder_.dispose();
                this.hmacParamsBuilder_ = null;
            }
            return this;
        }
        
        @Override
        public Descriptors.Descriptor getDescriptorForType() {
            return AesCtrHmacStreaming.internal_static_google_crypto_tink_AesCtrHmacStreamingParams_descriptor;
        }
        
        @Override
        public AesCtrHmacStreamingParams getDefaultInstanceForType() {
            return AesCtrHmacStreamingParams.getDefaultInstance();
        }
        
        @Override
        public AesCtrHmacStreamingParams build() {
            final AesCtrHmacStreamingParams result = this.buildPartial();
            if (!result.isInitialized()) {
                throw AbstractMessage.Builder.newUninitializedMessageException(result);
            }
            return result;
        }
        
        @Override
        public AesCtrHmacStreamingParams buildPartial() {
            final AesCtrHmacStreamingParams result = new AesCtrHmacStreamingParams(this, null);
            if (this.bitField0_ != 0) {
                this.buildPartial0(result);
            }
            this.onBuilt();
            return result;
        }
        
        private void buildPartial0(final AesCtrHmacStreamingParams result) {
            final int from_bitField0_ = this.bitField0_;
            if ((from_bitField0_ & 0x1) != 0x0) {
                result.ciphertextSegmentSize_ = this.ciphertextSegmentSize_;
            }
            if ((from_bitField0_ & 0x2) != 0x0) {
                result.derivedKeySize_ = this.derivedKeySize_;
            }
            if ((from_bitField0_ & 0x4) != 0x0) {
                result.hkdfHashType_ = this.hkdfHashType_;
            }
            int to_bitField0_ = 0;
            if ((from_bitField0_ & 0x8) != 0x0) {
                result.hmacParams_ = ((this.hmacParamsBuilder_ == null) ? this.hmacParams_ : this.hmacParamsBuilder_.build());
                to_bitField0_ |= 0x1;
            }
            result.bitField0_ |= to_bitField0_;
        }
        
        @Override
        public Builder mergeFrom(final Message other) {
            if (other instanceof AesCtrHmacStreamingParams) {
                return this.mergeFrom((AesCtrHmacStreamingParams)other);
            }
            super.mergeFrom(other);
            return this;
        }
        
        public Builder mergeFrom(final AesCtrHmacStreamingParams other) {
            if (other == AesCtrHmacStreamingParams.getDefaultInstance()) {
                return this;
            }
            if (other.getCiphertextSegmentSize() != 0) {
                this.setCiphertextSegmentSize(other.getCiphertextSegmentSize());
            }
            if (other.getDerivedKeySize() != 0) {
                this.setDerivedKeySize(other.getDerivedKeySize());
            }
            if (other.hkdfHashType_ != 0) {
                this.setHkdfHashTypeValue(other.getHkdfHashTypeValue());
            }
            if (other.hasHmacParams()) {
                this.mergeHmacParams(other.getHmacParams());
            }
            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.ciphertextSegmentSize_ = input.readUInt32();
                            this.bitField0_ |= 0x1;
                            continue;
                        }
                        case 16: {
                            this.derivedKeySize_ = input.readUInt32();
                            this.bitField0_ |= 0x2;
                            continue;
                        }
                        case 24: {
                            this.hkdfHashType_ = input.readEnum();
                            this.bitField0_ |= 0x4;
                            continue;
                        }
                        case 34: {
                            input.readMessage(this.internalGetHmacParamsFieldBuilder().getBuilder(), extensionRegistry);
                            this.bitField0_ |= 0x8;
                            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 getCiphertextSegmentSize() {
            return this.ciphertextSegmentSize_;
        }
        
        public Builder setCiphertextSegmentSize(final int value) {
            this.ciphertextSegmentSize_ = value;
            this.bitField0_ |= 0x1;
            this.onChanged();
            return this;
        }
        
        public Builder clearCiphertextSegmentSize() {
            this.bitField0_ &= 0xFFFFFFFE;
            this.ciphertextSegmentSize_ = 0;
            this.onChanged();
            return this;
        }
        
        @Override
        public int getDerivedKeySize() {
            return this.derivedKeySize_;
        }
        
        public Builder setDerivedKeySize(final int value) {
            this.derivedKeySize_ = value;
            this.bitField0_ |= 0x2;
            this.onChanged();
            return this;
        }
        
        public Builder clearDerivedKeySize() {
            this.bitField0_ &= 0xFFFFFFFD;
            this.derivedKeySize_ = 0;
            this.onChanged();
            return this;
        }
        
        @Override
        public int getHkdfHashTypeValue() {
            return this.hkdfHashType_;
        }
        
        public Builder setHkdfHashTypeValue(final int value) {
            this.hkdfHashType_ = value;
            this.bitField0_ |= 0x4;
            this.onChanged();
            return this;
        }
        
        @Override
        public HashType getHkdfHashType() {
            final HashType result = HashType.forNumber(this.hkdfHashType_);
            return (result == null) ? HashType.UNRECOGNIZED : result;
        }
        
        public Builder setHkdfHashType(final HashType value) {
            if (value == null) {
                throw new NullPointerException();
            }
            this.bitField0_ |= 0x4;
            this.hkdfHashType_ = value.getNumber();
            this.onChanged();
            return this;
        }
        
        public Builder clearHkdfHashType() {
            this.bitField0_ &= 0xFFFFFFFB;
            this.hkdfHashType_ = 0;
            this.onChanged();
            return this;
        }
        
        @Override
        public boolean hasHmacParams() {
            return (this.bitField0_ & 0x8) != 0x0;
        }
        
        @Override
        public HmacParams getHmacParams() {
            if (this.hmacParamsBuilder_ == null) {
                return (this.hmacParams_ == null) ? HmacParams.getDefaultInstance() : this.hmacParams_;
            }
            return this.hmacParamsBuilder_.getMessage();
        }
        
        public Builder setHmacParams(final HmacParams value) {
            if (this.hmacParamsBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                this.hmacParams_ = value;
            }
            else {
                this.hmacParamsBuilder_.setMessage(value);
            }
            this.bitField0_ |= 0x8;
            this.onChanged();
            return this;
        }
        
        public Builder setHmacParams(final HmacParams.Builder builderForValue) {
            if (this.hmacParamsBuilder_ == null) {
                this.hmacParams_ = builderForValue.build();
            }
            else {
                this.hmacParamsBuilder_.setMessage(builderForValue.build());
            }
            this.bitField0_ |= 0x8;
            this.onChanged();
            return this;
        }
        
        public Builder mergeHmacParams(final HmacParams value) {
            if (this.hmacParamsBuilder_ == null) {
                if ((this.bitField0_ & 0x8) != 0x0 && this.hmacParams_ != null && this.hmacParams_ != HmacParams.getDefaultInstance()) {
                    this.getHmacParamsBuilder().mergeFrom(value);
                }
                else {
                    this.hmacParams_ = value;
                }
            }
            else {
                this.hmacParamsBuilder_.mergeFrom(value);
            }
            if (this.hmacParams_ != null) {
                this.bitField0_ |= 0x8;
                this.onChanged();
            }
            return this;
        }
        
        public Builder clearHmacParams() {
            this.bitField0_ &= 0xFFFFFFF7;
            this.hmacParams_ = null;
            if (this.hmacParamsBuilder_ != null) {
                this.hmacParamsBuilder_.dispose();
                this.hmacParamsBuilder_ = null;
            }
            this.onChanged();
            return this;
        }
        
        public HmacParams.Builder getHmacParamsBuilder() {
            this.bitField0_ |= 0x8;
            this.onChanged();
            return this.internalGetHmacParamsFieldBuilder().getBuilder();
        }
        
        @Override
        public HmacParamsOrBuilder getHmacParamsOrBuilder() {
            if (this.hmacParamsBuilder_ != null) {
                return this.hmacParamsBuilder_.getMessageOrBuilder();
            }
            return (this.hmacParams_ == null) ? HmacParams.getDefaultInstance() : this.hmacParams_;
        }
        
        private SingleFieldBuilder<HmacParams, HmacParams.Builder, HmacParamsOrBuilder> internalGetHmacParamsFieldBuilder() {
            if (this.hmacParamsBuilder_ == null) {
                this.hmacParamsBuilder_ = new SingleFieldBuilder<HmacParams, HmacParams.Builder, HmacParamsOrBuilder>(this.getHmacParams(), this.getParentForChildren(), this.isClean());
                this.hmacParams_ = null;
            }
            return this.hmacParamsBuilder_;
        }
    }
}
