//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.google.type;

import com.google.protobuf.AbstractParser;
import com.google.protobuf.ByteString;
import com.google.protobuf.CodedInputStream;
import com.google.protobuf.CodedOutputStream;
import com.google.protobuf.ExtensionRegistryLite;
import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.Internal;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Message;
import com.google.protobuf.Parser;
import com.google.protobuf.UnknownFieldSet;
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.Descriptors.OneofDescriptor;
import com.google.protobuf.GeneratedMessageV3.BuilderParent;
import com.google.protobuf.GeneratedMessageV3.FieldAccessorTable;
import com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;

public final class Money extends GeneratedMessageV3 implements MoneyOrBuilder {
    private static final long serialVersionUID = 0L;
    public static final int CURRENCY_CODE_FIELD_NUMBER = 1;
    private volatile Object currencyCode_;
    public static final int UNITS_FIELD_NUMBER = 2;
    private long units_;
    public static final int NANOS_FIELD_NUMBER = 3;
    private int nanos_;
    private byte memoizedIsInitialized;
    private static final Money DEFAULT_INSTANCE = new Money();
    private static final Parser<Money> PARSER = new AbstractParser<Money>() {
        public Money parsePartialFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
            return new Money(input, extensionRegistry);
        }
    };

    private Money(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
        super(builder);
        this.memoizedIsInitialized = -1;
    }

    private Money() {
        this.memoizedIsInitialized = -1;
        this.currencyCode_ = "";
    }

    protected Object newInstance(UnusedPrivateParameter unused) {
        return new Money();
    }

    public final UnknownFieldSet getUnknownFields() {
        return this.unknownFields;
    }

    private Money(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        this();
        if (extensionRegistry == null) {
            throw new NullPointerException();
        } else {
            com.google.protobuf.UnknownFieldSet.Builder unknownFields = UnknownFieldSet.newBuilder();

            try {
                boolean done = false;

                while(!done) {
                    int tag = input.readTag();
                    switch(tag) {
                    case 0:
                        done = true;
                        break;
                    case 10:
                        String s = input.readStringRequireUtf8();
                        this.currencyCode_ = s;
                        break;
                    case 16:
                        this.units_ = input.readInt64();
                        break;
                    case 24:
                        this.nanos_ = input.readInt32();
                        break;
                    default:
                        if (!this.parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                            done = true;
                        }
                    }
                }
            } catch (InvalidProtocolBufferException var11) {
                throw var11.setUnfinishedMessage(this);
            } catch (IOException var12) {
                throw (new InvalidProtocolBufferException(var12)).setUnfinishedMessage(this);
            } finally {
                this.unknownFields = unknownFields.build();
                this.makeExtensionsImmutable();
            }

        }
    }

    public static final Descriptor getDescriptor() {
        return MoneyProto.internal_static_google_type_Money_descriptor;
    }

    protected FieldAccessorTable internalGetFieldAccessorTable() {
        return MoneyProto.internal_static_google_type_Money_fieldAccessorTable.ensureFieldAccessorsInitialized(Money.class, Money.Builder.class);
    }

    public String getCurrencyCode() {
        Object ref = this.currencyCode_;
        if (ref instanceof String) {
            return (String)ref;
        } else {
            ByteString bs = (ByteString)ref;
            String s = bs.toStringUtf8();
            this.currencyCode_ = s;
            return s;
        }
    }

    public ByteString getCurrencyCodeBytes() {
        Object ref = this.currencyCode_;
        if (ref instanceof String) {
            ByteString b = ByteString.copyFromUtf8((String)ref);
            this.currencyCode_ = b;
            return b;
        } else {
            return (ByteString)ref;
        }
    }

    public long getUnits() {
        return this.units_;
    }

    public int getNanos() {
        return this.nanos_;
    }

    public final boolean isInitialized() {
        byte isInitialized = this.memoizedIsInitialized;
        if (isInitialized == 1) {
            return true;
        } else if (isInitialized == 0) {
            return false;
        } else {
            this.memoizedIsInitialized = 1;
            return true;
        }
    }

    public void writeTo(CodedOutputStream output) throws IOException {
        if (!this.getCurrencyCodeBytes().isEmpty()) {
            GeneratedMessageV3.writeString(output, 1, this.currencyCode_);
        }

        if (this.units_ != 0L) {
            output.writeInt64(2, this.units_);
        }

        if (this.nanos_ != 0) {
            output.writeInt32(3, this.nanos_);
        }

        this.unknownFields.writeTo(output);
    }

    public int getSerializedSize() {
        int size = this.memoizedSize;
        if (size != -1) {
            return size;
        } else {
            size = 0;
            if (!this.getCurrencyCodeBytes().isEmpty()) {
                size += GeneratedMessageV3.computeStringSize(1, this.currencyCode_);
            }

            if (this.units_ != 0L) {
                size += CodedOutputStream.computeInt64Size(2, this.units_);
            }

            if (this.nanos_ != 0) {
                size += CodedOutputStream.computeInt32Size(3, this.nanos_);
            }

            size += this.unknownFields.getSerializedSize();
            this.memoizedSize = size;
            return size;
        }
    }

    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        } else if (!(obj instanceof Money)) {
            return super.equals(obj);
        } else {
            Money other = (Money)obj;
            if (!this.getCurrencyCode().equals(other.getCurrencyCode())) {
                return false;
            } else if (this.getUnits() != other.getUnits()) {
                return false;
            } else if (this.getNanos() != other.getNanos()) {
                return false;
            } else {
                return this.unknownFields.equals(other.unknownFields);
            }
        }
    }

    public int hashCode() {
        if (this.memoizedHashCode != 0) {
            return this.memoizedHashCode;
        } else {
            int hash = 41;
            int hash = 19 * hash + getDescriptor().hashCode();
            hash = 37 * hash + 1;
            hash = 53 * hash + this.getCurrencyCode().hashCode();
            hash = 37 * hash + 2;
            hash = 53 * hash + Internal.hashLong(this.getUnits());
            hash = 37 * hash + 3;
            hash = 53 * hash + this.getNanos();
            hash = 29 * hash + this.unknownFields.hashCode();
            this.memoizedHashCode = hash;
            return hash;
        }
    }

    public static Money parseFrom(ByteBuffer data) throws InvalidProtocolBufferException {
        return (Money)PARSER.parseFrom(data);
    }

    public static Money parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return (Money)PARSER.parseFrom(data, extensionRegistry);
    }

    public static Money parseFrom(ByteString data) throws InvalidProtocolBufferException {
        return (Money)PARSER.parseFrom(data);
    }

    public static Money parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return (Money)PARSER.parseFrom(data, extensionRegistry);
    }

    public static Money parseFrom(byte[] data) throws InvalidProtocolBufferException {
        return (Money)PARSER.parseFrom(data);
    }

    public static Money parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return (Money)PARSER.parseFrom(data, extensionRegistry);
    }

    public static Money parseFrom(InputStream input) throws IOException {
        return (Money)GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static Money parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws IOException {
        return (Money)GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry);
    }

    public static Money parseDelimitedFrom(InputStream input) throws IOException {
        return (Money)GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
    }

    public static Money parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws IOException {
        return (Money)GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
    }

    public static Money parseFrom(CodedInputStream input) throws IOException {
        return (Money)GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static Money parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException {
        return (Money)GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry);
    }

    public Money.Builder newBuilderForType() {
        return newBuilder();
    }

    public static Money.Builder newBuilder() {
        return DEFAULT_INSTANCE.toBuilder();
    }

    public static Money.Builder newBuilder(Money prototype) {
        return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    public Money.Builder toBuilder() {
        return this == DEFAULT_INSTANCE ? new Money.Builder() : (new Money.Builder()).mergeFrom(this);
    }

    protected Money.Builder newBuilderForType(BuilderParent parent) {
        Money.Builder builder = new Money.Builder(parent);
        return builder;
    }

    public static Money getDefaultInstance() {
        return DEFAULT_INSTANCE;
    }

    public static Parser<Money> parser() {
        return PARSER;
    }

    public Parser<Money> getParserForType() {
        return PARSER;
    }

    public Money getDefaultInstanceForType() {
        return DEFAULT_INSTANCE;
    }

    public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Money.Builder> implements MoneyOrBuilder {
        private Object currencyCode_;
        private long units_;
        private int nanos_;

        public static final Descriptor getDescriptor() {
            return MoneyProto.internal_static_google_type_Money_descriptor;
        }

        protected FieldAccessorTable internalGetFieldAccessorTable() {
            return MoneyProto.internal_static_google_type_Money_fieldAccessorTable.ensureFieldAccessorsInitialized(Money.class, Money.Builder.class);
        }

        private Builder() {
            this.currencyCode_ = "";
            this.maybeForceBuilderInitialization();
        }

        private Builder(BuilderParent parent) {
            super(parent);
            this.currencyCode_ = "";
            this.maybeForceBuilderInitialization();
        }

        private void maybeForceBuilderInitialization() {
            if (Money.alwaysUseFieldBuilders) {
            }

        }

        public Money.Builder clear() {
            super.clear();
            this.currencyCode_ = "";
            this.units_ = 0L;
            this.nanos_ = 0;
            return this;
        }

        public Descriptor getDescriptorForType() {
            return MoneyProto.internal_static_google_type_Money_descriptor;
        }

        public Money getDefaultInstanceForType() {
            return Money.getDefaultInstance();
        }

        public Money build() {
            Money result = this.buildPartial();
            if (!result.isInitialized()) {
                throw newUninitializedMessageException(result);
            } else {
                return result;
            }
        }

        public Money buildPartial() {
            Money result = new Money(this);
            result.currencyCode_ = this.currencyCode_;
            result.units_ = this.units_;
            result.nanos_ = this.nanos_;
            this.onBuilt();
            return result;
        }

        public Money.Builder clone() {
            return (Money.Builder)super.clone();
        }

        public Money.Builder setField(FieldDescriptor field, Object value) {
            return (Money.Builder)super.setField(field, value);
        }

        public Money.Builder clearField(FieldDescriptor field) {
            return (Money.Builder)super.clearField(field);
        }

        public Money.Builder clearOneof(OneofDescriptor oneof) {
            return (Money.Builder)super.clearOneof(oneof);
        }

        public Money.Builder setRepeatedField(FieldDescriptor field, int index, Object value) {
            return (Money.Builder)super.setRepeatedField(field, index, value);
        }

        public Money.Builder addRepeatedField(FieldDescriptor field, Object value) {
            return (Money.Builder)super.addRepeatedField(field, value);
        }

        public Money.Builder mergeFrom(Message other) {
            if (other instanceof Money) {
                return this.mergeFrom((Money)other);
            } else {
                super.mergeFrom(other);
                return this;
            }
        }

        public Money.Builder mergeFrom(Money other) {
            if (other == Money.getDefaultInstance()) {
                return this;
            } else {
                if (!other.getCurrencyCode().isEmpty()) {
                    this.currencyCode_ = other.currencyCode_;
                    this.onChanged();
                }

                if (other.getUnits() != 0L) {
                    this.setUnits(other.getUnits());
                }

                if (other.getNanos() != 0) {
                    this.setNanos(other.getNanos());
                }

                this.mergeUnknownFields(other.unknownFields);
                this.onChanged();
                return this;
            }
        }

        public final boolean isInitialized() {
            return true;
        }

        public Money.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException {
            Money parsedMessage = null;

            try {
                parsedMessage = (Money)Money.PARSER.parsePartialFrom(input, extensionRegistry);
            } catch (InvalidProtocolBufferException var8) {
                parsedMessage = (Money)var8.getUnfinishedMessage();
                throw var8.unwrapIOException();
            } finally {
                if (parsedMessage != null) {
                    this.mergeFrom(parsedMessage);
                }

            }

            return this;
        }

        public String getCurrencyCode() {
            Object ref = this.currencyCode_;
            if (!(ref instanceof String)) {
                ByteString bs = (ByteString)ref;
                String s = bs.toStringUtf8();
                this.currencyCode_ = s;
                return s;
            } else {
                return (String)ref;
            }
        }

        public ByteString getCurrencyCodeBytes() {
            Object ref = this.currencyCode_;
            if (ref instanceof String) {
                ByteString b = ByteString.copyFromUtf8((String)ref);
                this.currencyCode_ = b;
                return b;
            } else {
                return (ByteString)ref;
            }
        }

        public Money.Builder setCurrencyCode(String value) {
            if (value == null) {
                throw new NullPointerException();
            } else {
                this.currencyCode_ = value;
                this.onChanged();
                return this;
            }
        }

        public Money.Builder clearCurrencyCode() {
            this.currencyCode_ = Money.getDefaultInstance().getCurrencyCode();
            this.onChanged();
            return this;
        }

        public Money.Builder setCurrencyCodeBytes(ByteString value) {
            if (value == null) {
                throw new NullPointerException();
            } else {
                Money.checkByteStringIsUtf8(value);
                this.currencyCode_ = value;
                this.onChanged();
                return this;
            }
        }

        public long getUnits() {
            return this.units_;
        }

        public Money.Builder setUnits(long value) {
            this.units_ = value;
            this.onChanged();
            return this;
        }

        public Money.Builder clearUnits() {
            this.units_ = 0L;
            this.onChanged();
            return this;
        }

        public int getNanos() {
            return this.nanos_;
        }

        public Money.Builder setNanos(int value) {
            this.nanos_ = value;
            this.onChanged();
            return this;
        }

        public Money.Builder clearNanos() {
            this.nanos_ = 0;
            this.onChanged();
            return this;
        }

        public final Money.Builder setUnknownFields(UnknownFieldSet unknownFields) {
            return (Money.Builder)super.setUnknownFields(unknownFields);
        }

        public final Money.Builder mergeUnknownFields(UnknownFieldSet unknownFields) {
            return (Money.Builder)super.mergeUnknownFields(unknownFields);
        }
    }
}