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

public final class HpkeParams extends GeneratedMessage implements HpkeParamsOrBuilder
{
    private static final long serialVersionUID = 0L;
    public static final int KEM_FIELD_NUMBER = 1;
    private int kem_;
    public static final int KDF_FIELD_NUMBER = 2;
    private int kdf_;
    public static final int AEAD_FIELD_NUMBER = 3;
    private int aead_;
    private byte memoizedIsInitialized;
    private static final HpkeParams DEFAULT_INSTANCE;
    private static final Parser<HpkeParams> PARSER;
    
    private HpkeParams(final GeneratedMessage.Builder<?> builder) {
        super(builder);
        this.kem_ = 0;
        this.kdf_ = 0;
        this.aead_ = 0;
        this.memoizedIsInitialized = -1;
    }
    
    private HpkeParams() {
        this.kem_ = 0;
        this.kdf_ = 0;
        this.aead_ = 0;
        this.memoizedIsInitialized = -1;
        this.kem_ = 0;
        this.kdf_ = 0;
        this.aead_ = 0;
    }
    
    public static final Descriptors.Descriptor getDescriptor() {
        return Hpke.internal_static_google_crypto_tink_HpkeParams_descriptor;
    }
    
    @Override
    protected FieldAccessorTable internalGetFieldAccessorTable() {
        return Hpke.internal_static_google_crypto_tink_HpkeParams_fieldAccessorTable.ensureFieldAccessorsInitialized(HpkeParams.class, Builder.class);
    }
    
    @Override
    public int getKemValue() {
        return this.kem_;
    }
    
    @Override
    public HpkeKem getKem() {
        final HpkeKem result = HpkeKem.forNumber(this.kem_);
        return (result == null) ? HpkeKem.UNRECOGNIZED : result;
    }
    
    @Override
    public int getKdfValue() {
        return this.kdf_;
    }
    
    @Override
    public HpkeKdf getKdf() {
        final HpkeKdf result = HpkeKdf.forNumber(this.kdf_);
        return (result == null) ? HpkeKdf.UNRECOGNIZED : result;
    }
    
    @Override
    public int getAeadValue() {
        return this.aead_;
    }
    
    @Override
    public HpkeAead getAead() {
        final HpkeAead result = HpkeAead.forNumber(this.aead_);
        return (result == null) ? HpkeAead.UNRECOGNIZED : result;
    }
    
    @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.kem_ != HpkeKem.KEM_UNKNOWN.getNumber()) {
            output.writeEnum(1, this.kem_);
        }
        if (this.kdf_ != HpkeKdf.KDF_UNKNOWN.getNumber()) {
            output.writeEnum(2, this.kdf_);
        }
        if (this.aead_ != HpkeAead.AEAD_UNKNOWN.getNumber()) {
            output.writeEnum(3, this.aead_);
        }
        this.getUnknownFields().writeTo(output);
    }
    
    @Override
    public int getSerializedSize() {
        int size = this.memoizedSize;
        if (size != -1) {
            return size;
        }
        size = 0;
        if (this.kem_ != HpkeKem.KEM_UNKNOWN.getNumber()) {
            size += CodedOutputStream.computeEnumSize(1, this.kem_);
        }
        if (this.kdf_ != HpkeKdf.KDF_UNKNOWN.getNumber()) {
            size += CodedOutputStream.computeEnumSize(2, this.kdf_);
        }
        if (this.aead_ != HpkeAead.AEAD_UNKNOWN.getNumber()) {
            size += CodedOutputStream.computeEnumSize(3, this.aead_);
        }
        size += this.getUnknownFields().getSerializedSize();
        return this.memoizedSize = size;
    }
    
    @Override
    public boolean equals(final Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof HpkeParams)) {
            return super.equals(obj);
        }
        final HpkeParams other = (HpkeParams)obj;
        return this.kem_ == other.kem_ && this.kdf_ == other.kdf_ && this.aead_ == other.aead_ && 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.kem_;
        hash = 37 * hash + 2;
        hash = 53 * hash + this.kdf_;
        hash = 37 * hash + 3;
        hash = 53 * hash + this.aead_;
        hash = 29 * hash + this.getUnknownFields().hashCode();
        return this.memoizedHashCode = hash;
    }
    
    public static HpkeParams parseFrom(final ByteBuffer data) throws InvalidProtocolBufferException {
        return HpkeParams.PARSER.parseFrom(data);
    }
    
    public static HpkeParams parseFrom(final ByteBuffer data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return HpkeParams.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static HpkeParams parseFrom(final ByteString data) throws InvalidProtocolBufferException {
        return HpkeParams.PARSER.parseFrom(data);
    }
    
    public static HpkeParams parseFrom(final ByteString data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return HpkeParams.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static HpkeParams parseFrom(final byte[] data) throws InvalidProtocolBufferException {
        return HpkeParams.PARSER.parseFrom(data);
    }
    
    public static HpkeParams parseFrom(final byte[] data, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return HpkeParams.PARSER.parseFrom(data, extensionRegistry);
    }
    
    public static HpkeParams parseFrom(final InputStream input) throws IOException {
        return GeneratedMessage.parseWithIOException(HpkeParams.PARSER, input);
    }
    
    public static HpkeParams parseFrom(final InputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseWithIOException(HpkeParams.PARSER, input, extensionRegistry);
    }
    
    public static HpkeParams parseDelimitedFrom(final InputStream input) throws IOException {
        return GeneratedMessage.parseDelimitedWithIOException(HpkeParams.PARSER, input);
    }
    
    public static HpkeParams parseDelimitedFrom(final InputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseDelimitedWithIOException(HpkeParams.PARSER, input, extensionRegistry);
    }
    
    public static HpkeParams parseFrom(final CodedInputStream input) throws IOException {
        return GeneratedMessage.parseWithIOException(HpkeParams.PARSER, input);
    }
    
    public static HpkeParams parseFrom(final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException {
        return GeneratedMessage.parseWithIOException(HpkeParams.PARSER, input, extensionRegistry);
    }
    
    @Override
    public Builder newBuilderForType() {
        return newBuilder();
    }
    
    public static Builder newBuilder() {
        return HpkeParams.DEFAULT_INSTANCE.toBuilder();
    }
    
    public static Builder newBuilder(final HpkeParams prototype) {
        return HpkeParams.DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }
    
    @Override
    public Builder toBuilder() {
        return (this == HpkeParams.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 HpkeParams getDefaultInstance() {
        return HpkeParams.DEFAULT_INSTANCE;
    }
    
    public static Parser<HpkeParams> parser() {
        return HpkeParams.PARSER;
    }
    
    @Override
    public Parser<HpkeParams> getParserForType() {
        return HpkeParams.PARSER;
    }
    
    @Override
    public HpkeParams getDefaultInstanceForType() {
        return HpkeParams.DEFAULT_INSTANCE;
    }
    
    static {
        RuntimeVersion.validateProtobufGencodeVersion(RuntimeVersion.RuntimeDomain.PUBLIC, 4, 32, 1, "", HpkeParams.class.getName());
        DEFAULT_INSTANCE = new HpkeParams();
        PARSER = new AbstractParser<HpkeParams>() {
            @Override
            public HpkeParams parsePartialFrom(final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
                final Builder builder = HpkeParams.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 HpkeParamsOrBuilder
    {
        private int bitField0_;
        private int kem_;
        private int kdf_;
        private int aead_;
        
        public static final Descriptors.Descriptor getDescriptor() {
            return Hpke.internal_static_google_crypto_tink_HpkeParams_descriptor;
        }
        
        @Override
        protected FieldAccessorTable internalGetFieldAccessorTable() {
            return Hpke.internal_static_google_crypto_tink_HpkeParams_fieldAccessorTable.ensureFieldAccessorsInitialized(HpkeParams.class, Builder.class);
        }
        
        private Builder() {
            this.kem_ = 0;
            this.kdf_ = 0;
            this.aead_ = 0;
        }
        
        private Builder(final BuilderParent parent) {
            super(parent);
            this.kem_ = 0;
            this.kdf_ = 0;
            this.aead_ = 0;
        }
        
        @Override
        public Builder clear() {
            super.clear();
            this.bitField0_ = 0;
            this.kem_ = 0;
            this.kdf_ = 0;
            this.aead_ = 0;
            return this;
        }
        
        @Override
        public Descriptors.Descriptor getDescriptorForType() {
            return Hpke.internal_static_google_crypto_tink_HpkeParams_descriptor;
        }
        
        @Override
        public HpkeParams getDefaultInstanceForType() {
            return HpkeParams.getDefaultInstance();
        }
        
        @Override
        public HpkeParams build() {
            final HpkeParams result = this.buildPartial();
            if (!result.isInitialized()) {
                throw AbstractMessage.Builder.newUninitializedMessageException(result);
            }
            return result;
        }
        
        @Override
        public HpkeParams buildPartial() {
            final HpkeParams result = new HpkeParams(this, null);
            if (this.bitField0_ != 0) {
                this.buildPartial0(result);
            }
            this.onBuilt();
            return result;
        }
        
        private void buildPartial0(final HpkeParams result) {
            final int from_bitField0_ = this.bitField0_;
            if ((from_bitField0_ & 0x1) != 0x0) {
                result.kem_ = this.kem_;
            }
            if ((from_bitField0_ & 0x2) != 0x0) {
                result.kdf_ = this.kdf_;
            }
            if ((from_bitField0_ & 0x4) != 0x0) {
                result.aead_ = this.aead_;
            }
        }
        
        @Override
        public Builder mergeFrom(final Message other) {
            if (other instanceof HpkeParams) {
                return this.mergeFrom((HpkeParams)other);
            }
            super.mergeFrom(other);
            return this;
        }
        
        public Builder mergeFrom(final HpkeParams other) {
            if (other == HpkeParams.getDefaultInstance()) {
                return this;
            }
            if (other.kem_ != 0) {
                this.setKemValue(other.getKemValue());
            }
            if (other.kdf_ != 0) {
                this.setKdfValue(other.getKdfValue());
            }
            if (other.aead_ != 0) {
                this.setAeadValue(other.getAeadValue());
            }
            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.kem_ = input.readEnum();
                            this.bitField0_ |= 0x1;
                            continue;
                        }
                        case 16: {
                            this.kdf_ = input.readEnum();
                            this.bitField0_ |= 0x2;
                            continue;
                        }
                        case 24: {
                            this.aead_ = input.readEnum();
                            this.bitField0_ |= 0x4;
                            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 getKemValue() {
            return this.kem_;
        }
        
        public Builder setKemValue(final int value) {
            this.kem_ = value;
            this.bitField0_ |= 0x1;
            this.onChanged();
            return this;
        }
        
        @Override
        public HpkeKem getKem() {
            final HpkeKem result = HpkeKem.forNumber(this.kem_);
            return (result == null) ? HpkeKem.UNRECOGNIZED : result;
        }
        
        public Builder setKem(final HpkeKem value) {
            if (value == null) {
                throw new NullPointerException();
            }
            this.bitField0_ |= 0x1;
            this.kem_ = value.getNumber();
            this.onChanged();
            return this;
        }
        
        public Builder clearKem() {
            this.bitField0_ &= 0xFFFFFFFE;
            this.kem_ = 0;
            this.onChanged();
            return this;
        }
        
        @Override
        public int getKdfValue() {
            return this.kdf_;
        }
        
        public Builder setKdfValue(final int value) {
            this.kdf_ = value;
            this.bitField0_ |= 0x2;
            this.onChanged();
            return this;
        }
        
        @Override
        public HpkeKdf getKdf() {
            final HpkeKdf result = HpkeKdf.forNumber(this.kdf_);
            return (result == null) ? HpkeKdf.UNRECOGNIZED : result;
        }
        
        public Builder setKdf(final HpkeKdf value) {
            if (value == null) {
                throw new NullPointerException();
            }
            this.bitField0_ |= 0x2;
            this.kdf_ = value.getNumber();
            this.onChanged();
            return this;
        }
        
        public Builder clearKdf() {
            this.bitField0_ &= 0xFFFFFFFD;
            this.kdf_ = 0;
            this.onChanged();
            return this;
        }
        
        @Override
        public int getAeadValue() {
            return this.aead_;
        }
        
        public Builder setAeadValue(final int value) {
            this.aead_ = value;
            this.bitField0_ |= 0x4;
            this.onChanged();
            return this;
        }
        
        @Override
        public HpkeAead getAead() {
            final HpkeAead result = HpkeAead.forNumber(this.aead_);
            return (result == null) ? HpkeAead.UNRECOGNIZED : result;
        }
        
        public Builder setAead(final HpkeAead value) {
            if (value == null) {
                throw new NullPointerException();
            }
            this.bitField0_ |= 0x4;
            this.aead_ = value.getNumber();
            this.onChanged();
            return this;
        }
        
        public Builder clearAead() {
            this.bitField0_ &= 0xFFFFFFFB;
            this.aead_ = 0;
            this.onChanged();
            return this;
        }
    }
}
