// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;

import com.azure.data.cosmos.serialization.hybridrow.perf.*;
import com.google.protobuf.Message;
import com.google.protobuf.Parser;

// <auto-generated>
//     Generated by the protocol buffer compiler.  DO NOT EDIT!
//     source: TestData/CassandraHotelSchema.proto
// </auto-generated>

//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pb = Google.Protobuf;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbc = Google.Protobuf.Collections;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbr = Google.Protobuf.Reflection;

public final class PostalCode implements Message<PostalCode> {
    /**
     * Field number for the "plus4" field.
     */
    public static final int Plus4FieldNumber = 2;
    /**
     * Field number for the "zip" field.
     */
    public static final int ZipFieldNumber = 1;
    private static final Parser<PostalCode> _parser = new Parser<PostalCode>(() -> new PostalCode());
    private static final Google.Protobuf.FieldCodec<Integer> _single_plus4_codec =
        Google.Protobuf.FieldCodec.<Integer>ForStructWrapper(18);
    private static final Google.Protobuf.FieldCodec<Integer> _single_zip_codec =
        Google.Protobuf.FieldCodec.<Integer>ForStructWrapper(10);
    private Google.Protobuf.UnknownFieldSet _unknownFields;

    // TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
    //	partial void OnConstruction();
    private Integer plus4_;
    private Integer zip_;

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public PostalCode()
    public PostalCode() {
        OnConstruction();
    }
    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public PostalCode(PostalCode other)
    public PostalCode(PostalCode other) {
        this();
        setZip(other.getZip());
        setPlus4(other.getPlus4());
        _unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
    // .MessageDescriptor Descriptor
    public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
        return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[0];
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
    public Google.Protobuf.Reflection getDescriptor() {
        return getDescriptor();
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
    // .MessageParser<PostalCode> Parser
    public static Google.Protobuf.MessageParser<PostalCode> getParser() {
        return _parser;
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<int> Plus4
    public Integer getPlus4() {
        return plus4_;
    }

    public void setPlus4(Integer value) {
        plus4_ = value;
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<int> Zip
    public Integer getZip() {
        return zip_;
    }

    public void setZip(Integer value) {
        zip_ = value;
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
    public int CalculateSize() {
        int size = 0;
        if (zip_ != null) {
            size += _single_zip_codec.CalculateSizeWithTag(getZip());
        }
        if (plus4_ != null) {
            size += _single_plus4_codec.CalculateSizeWithTag(getPlus4());
        }
        if (_unknownFields != null) {
            size += _unknownFields.CalculateSize();
        }
        return size;
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public PostalCode Clone()
    public PostalCode Clone() {
        return new PostalCode(this);
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(PostalCode other)
    public void MergeFrom(PostalCode other) {
        if (other == null) {
            return;
        }
        if (other.zip_ != null) {
            if (zip_ == null || other.getZip() != 0) {
                setZip(other.getZip());
            }
        }
        if (other.plus4_ != null) {
            if (plus4_ == null || other.getPlus4() != 0) {
                setPlus4(other.getPlus4());
            }
        }
        _unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
    // .CodedInputStream input)
    public void MergeFrom(Google.Protobuf.CodedInputStream input) {
        //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
        //ORIGINAL LINE: uint tag;
        int tag;
        while ((tag = input.ReadTag()) != 0) {
            switch (tag) {
                default:
                    _unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
                    break;
                case 10: {
                    Integer value = _single_zip_codec.Read(input);
                    if (zip_ == null || value != 0) {
                        setZip(value);
                    }
                    break;
                }
                case 18: {
                    Integer value = _single_plus4_codec.Read(input);
                    if (plus4_ == null || value != 0) {
                        setPlus4(value);
                    }
                    break;
                }
            }
        }
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
    // .CodedOutputStream output)
    public void WriteTo(Google.Protobuf.CodedOutputStream output) {
        if (zip_ != null) {
            _single_zip_codec.WriteTagAndValue(output, getZip());
        }
        if (plus4_ != null) {
            _single_plus4_codec.WriteTagAndValue(output, getPlus4());
        }
        if (_unknownFields != null) {
            _unknownFields.WriteTo(output);
        }
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
    @Override
    public boolean equals(Object other) {
        return Equals(other instanceof PostalCode ? (PostalCode)other : null);
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(PostalCode other)
    public boolean equals(PostalCode other) {
        if (ReferenceEquals(other, null)) {
            return false;
        }
        if (ReferenceEquals(other, this)) {
            return true;
        }
        if (getZip() != other.getZip()) {
            return false;
        }
        if (getPlus4() != other.getPlus4()) {
            return false;
        }
        return Equals(_unknownFields, other._unknownFields);
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
    @Override
    public int hashCode() {
        int hash = 1;
        if (zip_ != null) {
            hash ^= getZip().hashCode();
        }
        if (plus4_ != null) {
            hash ^= getPlus4().hashCode();
        }
        if (_unknownFields != null) {
            hash ^= _unknownFields.hashCode();
        }
        return hash;
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
    @Override
    public String toString() {
        return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
    }

}