/**
 * 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 ComplexFieldNames extends Exception implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("ComplexFieldNames");
  private static final TField ERROR_MESSAGE_FIELD_DESC = new TField("error_message", TType.STRING, (short)1);
  private static final TField INTERNAL_ERROR_MESSAGE_FIELD_DESC = new TField("internal_error_message", TType.STRING, (short)2);

  public String error_message;
  public String internal_error_message;
  public static final int ERROR_MESSAGE = 1;
  public static final int INTERNAL_ERROR_MESSAGE = 2;

  // isset id assignments

  public static final Map<Integer, FieldMetaData> metaDataMap;

  static {
    Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
    tmpMetaDataMap.put(ERROR_MESSAGE, new FieldMetaData("error_message", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(INTERNAL_ERROR_MESSAGE, new FieldMetaData("internal_error_message", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
  }

  static {
    FieldMetaData.addStructMetaDataMap(ComplexFieldNames.class, metaDataMap);
  }

  public ComplexFieldNames() {
  }

  public ComplexFieldNames(
      String error_message,
      String internal_error_message) {
    this();
    this.error_message = error_message;
    this.internal_error_message = internal_error_message;
  }

  public static class Builder {
    private String error_message;
    private String internal_error_message;

    public Builder() {
    }

    public Builder setError_message(final String error_message) {
      this.error_message = error_message;
      return this;
    }

    public Builder setInternal_error_message(final String internal_error_message) {
      this.internal_error_message = internal_error_message;
      return this;
    }

    public ComplexFieldNames build() {
      ComplexFieldNames result = new ComplexFieldNames();
      result.setError_message(this.error_message);
      result.setInternal_error_message(this.internal_error_message);
      return result;
    }
  }

  public static Builder builder() {
    return new Builder();
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ComplexFieldNames(ComplexFieldNames other) {
    if (other.isSetError_message()) {
      this.error_message = TBaseHelper.deepCopy(other.error_message);
    }
    if (other.isSetInternal_error_message()) {
      this.internal_error_message = TBaseHelper.deepCopy(other.internal_error_message);
    }
  }

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

  public String getError_message() {
    return this.error_message;
  }

  public ComplexFieldNames setError_message(String error_message) {
    this.error_message = error_message;
    return this;
  }

  public void unsetError_message() {
    this.error_message = null;
  }

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

  public void setError_messageIsSet(boolean __value) {
    if (!__value) {
      this.error_message = null;
    }
  }

  public String getInternal_error_message() {
    return this.internal_error_message;
  }

  public ComplexFieldNames setInternal_error_message(String internal_error_message) {
    this.internal_error_message = internal_error_message;
    return this;
  }

  public void unsetInternal_error_message() {
    this.internal_error_message = null;
  }

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

  public void setInternal_error_messageIsSet(boolean __value) {
    if (!__value) {
      this.internal_error_message = null;
    }
  }

  public void setFieldValue(int fieldID, Object __value) {
    switch (fieldID) {
    case ERROR_MESSAGE:
      if (__value == null) {
        unsetError_message();
      } else {
        setError_message((String)__value);
      }
      break;

    case INTERNAL_ERROR_MESSAGE:
      if (__value == null) {
        unsetInternal_error_message();
      } else {
        setInternal_error_message((String)__value);
      }
      break;

    default:
      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
    }
  }

  public Object getFieldValue(int fieldID) {
    switch (fieldID) {
    case ERROR_MESSAGE:
      return getError_message();

    case INTERNAL_ERROR_MESSAGE:
      return getInternal_error_message();

    default:
      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
    }
  }

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

    if (!TBaseHelper.equalsNobinary(this.isSetError_message(), that.isSetError_message(), this.error_message, that.error_message)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetInternal_error_message(), that.isSetInternal_error_message(), this.internal_error_message, that.internal_error_message)) { return false; }

    return true;
  }

  @Override
  public int hashCode() {
    return Arrays.deepHashCode(new Object[] {error_message, internal_error_message});
  }

  public void read(TProtocol iprot) throws TException {
    TField __field;
    iprot.readStructBegin(metaDataMap);
    while (true)
    {
      __field = iprot.readFieldBegin();
      if (__field.type == TType.STOP) {
        break;
      }
      switch (__field.id)
      {
        case ERROR_MESSAGE:
          if (__field.type == TType.STRING) {
            this.error_message = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case INTERNAL_ERROR_MESSAGE:
          if (__field.type == TType.STRING) {
            this.internal_error_message = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, __field.type);
          break;
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();


    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
  }

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

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.error_message != null) {
      oprot.writeFieldBegin(ERROR_MESSAGE_FIELD_DESC);
      oprot.writeString(this.error_message);
      oprot.writeFieldEnd();
    }
    if (this.internal_error_message != null) {
      oprot.writeFieldBegin(INTERNAL_ERROR_MESSAGE_FIELD_DESC);
      oprot.writeString(this.internal_error_message);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

  @Override
  public String toString(int indent, boolean prettyPrint) {
    String indentStr = prettyPrint ? TBaseHelper.getIndentedString(indent) : "";
    String newLine = prettyPrint ? "\n" : "";
    String space = prettyPrint ? " " : "";
    StringBuilder sb = new StringBuilder("ComplexFieldNames");
    sb.append(space);
    sb.append("(");
    sb.append(newLine);
    boolean first = true;

    sb.append(indentStr);
    sb.append("error_message");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getError_message() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getError_message(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("internal_error_message");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getInternal_error_message() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getInternal_error_message(), indent + 1, prettyPrint));
    }
    first = false;
    sb.append(newLine + TBaseHelper.reduceIndent(indentStr));
    sb.append(")");
    return sb.toString();
  }

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

}

