// 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 Address implements Message<Address> {
    /**
     * Field number for the "city" field.
     */
    public static final int CityFieldNumber = 2;
    /**
     * Field number for the "postal_code" field.
     */
    public static final int PostalCodeFieldNumber = 4;
    /**
     * Field number for the "state" field.
     */
    public static final int StateFieldNumber = 3;
    /**
     * Field number for the "street" field.
     */
    public static final int StreetFieldNumber = 1;
    private static final Parser<?> _parser = new Address().getParserForType();
    private static final Google.Protobuf.FieldCodec<String> _single_city_codec = Google.Protobuf.FieldCodec.<String>ForClassWrapper(18);

    // TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
    //	partial void OnConstruction();
    private static final Google.Protobuf.FieldCodec<String> _single_state_codec =
		Google.Protobuf.FieldCodec.<String>ForClassWrapper(26);
    private static final Google.Protobuf.FieldCodec<String> _single_street_codec =
		Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
    private Google.Protobuf.UnknownFieldSet _unknownFields;
    private String city_;
    private PostalCode postalCode_;
    private String state_;
    private String street_;

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Address()
    public Address() {
        OnConstruction();
    }
    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Address(Address other)
    public Address(Address other) {
        this();
        setStreet(other.getStreet());
        setCity(other.getCity());
        setState(other.getState());
        setPostalCode(other.postalCode_ != null ? other.getPostalCode().Clone() : null);
        _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 string City
    public String getCity() {
        return city_;
    }

    public void setCity(String value) {
        city_ = value;
    }

    // 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.Reflection
	// .MessageDescriptor Descriptor
    public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
        return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[1];
    }

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

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Microsoft.Azure.Cosmos.Serialization
	// .HybridRow.Tests.Perf.CassandraHotel.Protobuf.PostalCode PostalCode
    public PostalCode getPostalCode() {
        return postalCode_;
    }

    public void setPostalCode(PostalCode value) {
        postalCode_ = value;
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string State
    public String getState() {
        return state_;
    }

    public void setState(String value) {
        state_ = value;
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Street
    public String getStreet() {
        return street_;
    }

    public void setStreet(String value) {
        street_ = 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 (street_ != null) {
            size += _single_street_codec.CalculateSizeWithTag(getStreet());
        }
        if (city_ != null) {
            size += _single_city_codec.CalculateSizeWithTag(getCity());
        }
        if (state_ != null) {
            size += _single_state_codec.CalculateSizeWithTag(getState());
        }
        if (postalCode_ != null) {
            size += 1 + Google.Protobuf.CodedOutputStream.ComputeMessageSize(getPostalCode());
        }
        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 Address Clone()
    public Address Clone() {
        return new Address(this);
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Address other)
    public void MergeFrom(Address other) {
        if (other == null) {
            return;
        }
        if (other.street_ != null) {
            if (street_ == null || !other.getStreet().equals("")) {
                setStreet(other.getStreet());
            }
        }
        if (other.city_ != null) {
            if (city_ == null || !other.getCity().equals("")) {
                setCity(other.getCity());
            }
        }
        if (other.state_ != null) {
            if (state_ == null || !other.getState().equals("")) {
                setState(other.getState());
            }
        }
        if (other.postalCode_ != null) {
            if (postalCode_ == null) {
                postalCode_ = new PostalCode();
            }
            getPostalCode().MergeFrom(other.getPostalCode());
        }
        _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: {
                    String value = _single_street_codec.Read(input);
                    if (street_ == null || !value.equals("")) {
                        setStreet(value);
                    }
                    break;
                }
                case 18: {
                    String value = _single_city_codec.Read(input);
                    if (city_ == null || !value.equals("")) {
                        setCity(value);
                    }
                    break;
                }
                case 26: {
                    String value = _single_state_codec.Read(input);
                    if (state_ == null || !value.equals("")) {
                        setState(value);
                    }
                    break;
                }
                case 34: {
                    if (postalCode_ == null) {
                        postalCode_ = new PostalCode();
                    }
                    input.ReadMessage(postalCode_);
                    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 (street_ != null) {
            _single_street_codec.WriteTagAndValue(output, getStreet());
        }
        if (city_ != null) {
            _single_city_codec.WriteTagAndValue(output, getCity());
        }
        if (state_ != null) {
            _single_state_codec.WriteTagAndValue(output, getState());
        }
        if (postalCode_ != null) {
            output.WriteRawTag(34);
            output.WriteMessage(getPostalCode());
        }
        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 Address ? (Address)other : null);
    }

    // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
    //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Address other)
    public boolean equals(Address other) {
        if (ReferenceEquals(other, null)) {
            return false;
        }
        if (ReferenceEquals(other, this)) {
            return true;
        }
        if (!getStreet().equals(other.getStreet())) {
            return false;
        }
        if (!getCity().equals(other.getCity())) {
            return false;
        }
        if (!getState().equals(other.getState())) {
            return false;
        }
        if (!getPostalCode().equals(other.getPostalCode())) {
            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 (street_ != null) {
            hash ^= getStreet().hashCode();
        }
        if (city_ != null) {
            hash ^= getCity().hashCode();
        }
        if (state_ != null) {
            hash ^= getState().hashCode();
        }
        if (postalCode_ != null) {
            hash ^= getPostalCode().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);
    }

}