/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;
import java.util.BitSet;
import java.util.Arrays;
import com.facebook.thrift.*;
import com.facebook.thrift.annotations.*;
import com.facebook.thrift.async.*;
import com.facebook.thrift.meta_data.*;
import com.facebook.thrift.server.*;
import com.facebook.thrift.transport.*;
import com.facebook.thrift.protocol.*;

@SuppressWarnings({ "unused", "serial" })
public class StructWithString implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("StructWithString");
  private static final TField DEF_UNIQUE_STRING_REF_FIELD_DESC = new TField("def_unique_string_ref", TType.STRING, (short)1);
  private static final TField DEF_SHARED_STRING_REF_FIELD_DESC = new TField("def_shared_string_ref", TType.STRING, (short)2);
  private static final TField DEF_SHARED_STRING_CONST_REF_FIELD_DESC = new TField("def_shared_string_const_ref", TType.STRING, (short)3);
  private static final TField UNIQUE_STRING_REF_FIELD_DESC = new TField("unique_string_ref", TType.STRING, (short)4);
  private static final TField SHARED_STRING_REF_FIELD_DESC = new TField("shared_string_ref", TType.STRING, (short)5);

  public final String def_unique_string_ref;
  public final String def_shared_string_ref;
  public final String def_shared_string_const_ref;
  public final String unique_string_ref;
  public final String shared_string_ref;
  public static final int DEF_UNIQUE_STRING_REF = 1;
  public static final int DEF_SHARED_STRING_REF = 2;
  public static final int DEF_SHARED_STRING_CONST_REF = 3;
  public static final int UNIQUE_STRING_REF = 4;
  public static final int SHARED_STRING_REF = 5;

  public StructWithString(
      String def_unique_string_ref,
      String def_shared_string_ref,
      String def_shared_string_const_ref,
      String unique_string_ref,
      String shared_string_ref) {
    this.def_unique_string_ref = def_unique_string_ref;
    this.def_shared_string_ref = def_shared_string_ref;
    this.def_shared_string_const_ref = def_shared_string_const_ref;
    this.unique_string_ref = unique_string_ref;
    this.shared_string_ref = shared_string_ref;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public StructWithString(StructWithString other) {
    if (other.isSetDef_unique_string_ref()) {
      this.def_unique_string_ref = TBaseHelper.deepCopy(other.def_unique_string_ref);
    } else {
      this.def_unique_string_ref = null;
    }
    if (other.isSetDef_shared_string_ref()) {
      this.def_shared_string_ref = TBaseHelper.deepCopy(other.def_shared_string_ref);
    } else {
      this.def_shared_string_ref = null;
    }
    if (other.isSetDef_shared_string_const_ref()) {
      this.def_shared_string_const_ref = TBaseHelper.deepCopy(other.def_shared_string_const_ref);
    } else {
      this.def_shared_string_const_ref = null;
    }
    if (other.isSetUnique_string_ref()) {
      this.unique_string_ref = TBaseHelper.deepCopy(other.unique_string_ref);
    } else {
      this.unique_string_ref = null;
    }
    if (other.isSetShared_string_ref()) {
      this.shared_string_ref = TBaseHelper.deepCopy(other.shared_string_ref);
    } else {
      this.shared_string_ref = null;
    }
  }

  public StructWithString deepCopy() {
    return new StructWithString(this);
  }

  public String getDef_unique_string_ref() {
    return this.def_unique_string_ref;
  }

  // Returns true if field def_unique_string_ref is set (has been assigned a value) and false otherwise
  public boolean isSetDef_unique_string_ref() {
    return this.def_unique_string_ref != null;
  }

  public String getDef_shared_string_ref() {
    return this.def_shared_string_ref;
  }

  // Returns true if field def_shared_string_ref is set (has been assigned a value) and false otherwise
  public boolean isSetDef_shared_string_ref() {
    return this.def_shared_string_ref != null;
  }

  public String getDef_shared_string_const_ref() {
    return this.def_shared_string_const_ref;
  }

  // Returns true if field def_shared_string_const_ref is set (has been assigned a value) and false otherwise
  public boolean isSetDef_shared_string_const_ref() {
    return this.def_shared_string_const_ref != null;
  }

  public String getUnique_string_ref() {
    return this.unique_string_ref;
  }

  // Returns true if field unique_string_ref is set (has been assigned a value) and false otherwise
  public boolean isSetUnique_string_ref() {
    return this.unique_string_ref != null;
  }

  public String getShared_string_ref() {
    return this.shared_string_ref;
  }

  // Returns true if field shared_string_ref is set (has been assigned a value) and false otherwise
  public boolean isSetShared_string_ref() {
    return this.shared_string_ref != null;
  }

  @Override
  public boolean equals(Object _that) {
    if (_that == null)
      return false;
    if (this == _that)
      return true;
    if (!(_that instanceof StructWithString))
      return false;
    StructWithString that = (StructWithString)_that;

    if (!TBaseHelper.equalsNobinary(this.isSetDef_unique_string_ref(), that.isSetDef_unique_string_ref(), this.def_unique_string_ref, that.def_unique_string_ref)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetDef_shared_string_ref(), that.isSetDef_shared_string_ref(), this.def_shared_string_ref, that.def_shared_string_ref)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetDef_shared_string_const_ref(), that.isSetDef_shared_string_const_ref(), this.def_shared_string_const_ref, that.def_shared_string_const_ref)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetUnique_string_ref(), that.isSetUnique_string_ref(), this.unique_string_ref, that.unique_string_ref)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetShared_string_ref(), that.isSetShared_string_ref(), this.shared_string_ref, that.shared_string_ref)) { return false; }

    return true;
  }

  @Override
  public int hashCode() {
    return Arrays.deepHashCode(new Object[] {def_unique_string_ref, def_shared_string_ref, def_shared_string_const_ref, unique_string_ref, shared_string_ref});
  }

  // This is required to satisfy the TBase interface, but can't be implemented on immutable struture.
  public void read(TProtocol iprot) throws TException {
    throw new TException("unimplemented in android immutable structure");
  }

  public static StructWithString deserialize(TProtocol iprot) throws TException {
    String tmp_def_unique_string_ref = null;
    String tmp_def_shared_string_ref = null;
    String tmp_def_shared_string_const_ref = null;
    String tmp_unique_string_ref = null;
    String tmp_shared_string_ref = null;
    TField __field;
    iprot.readStructBegin();
    while (true)
    {
      __field = iprot.readFieldBegin();
      if (__field.type == TType.STOP) {
        break;
      }
      switch (__field.id)
      {
        case DEF_UNIQUE_STRING_REF:
          if (__field.type == TType.STRING) {
            tmp_def_unique_string_ref = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case DEF_SHARED_STRING_REF:
          if (__field.type == TType.STRING) {
            tmp_def_shared_string_ref = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case DEF_SHARED_STRING_CONST_REF:
          if (__field.type == TType.STRING) {
            tmp_def_shared_string_const_ref = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case UNIQUE_STRING_REF:
          if (__field.type == TType.STRING) {
            tmp_unique_string_ref = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case SHARED_STRING_REF:
          if (__field.type == TType.STRING) {
            tmp_shared_string_ref = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, __field.type);
          break;
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    StructWithString _that;
    _that = new StructWithString(
      tmp_def_unique_string_ref
      ,tmp_def_shared_string_ref
      ,tmp_def_shared_string_const_ref
      ,tmp_unique_string_ref
      ,tmp_shared_string_ref
    );
    _that.validate();
    return _that;
  }

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.def_unique_string_ref != null) {
      oprot.writeFieldBegin(DEF_UNIQUE_STRING_REF_FIELD_DESC);
      oprot.writeString(this.def_unique_string_ref);
      oprot.writeFieldEnd();
    }
    if (this.def_shared_string_ref != null) {
      oprot.writeFieldBegin(DEF_SHARED_STRING_REF_FIELD_DESC);
      oprot.writeString(this.def_shared_string_ref);
      oprot.writeFieldEnd();
    }
    if (this.def_shared_string_const_ref != null) {
      oprot.writeFieldBegin(DEF_SHARED_STRING_CONST_REF_FIELD_DESC);
      oprot.writeString(this.def_shared_string_const_ref);
      oprot.writeFieldEnd();
    }
    if (this.unique_string_ref != null) {
      oprot.writeFieldBegin(UNIQUE_STRING_REF_FIELD_DESC);
      oprot.writeString(this.unique_string_ref);
      oprot.writeFieldEnd();
    }
    if (this.shared_string_ref != null) {
      oprot.writeFieldBegin(SHARED_STRING_REF_FIELD_DESC);
      oprot.writeString(this.shared_string_ref);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    return toString(1, true);
  }

  @Override
  public String toString(int indent, boolean prettyPrint) {
    return TBaseHelper.toStringHelper(this, indent, prettyPrint);
  }

  public void validate() throws TException {
    // check for required fields
  }

}

