/**
 * 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 Vehicle implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("Vehicle");
  private static final TField COLOR_FIELD_DESC = new TField("color", TType.STRUCT, (short)1);
  private static final TField LICENSE_PLATE_FIELD_DESC = new TField("licensePlate", TType.STRING, (short)2);
  private static final TField DESCRIPTION_FIELD_DESC = new TField("description", TType.STRING, (short)3);
  private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)4);
  private static final TField HAS_AC_FIELD_DESC = new TField("hasAC", TType.BOOL, (short)5);

  public final Color color;
  public final String licensePlate;
  public final String description;
  public final String name;
  public final Boolean hasAC;
  public static final int COLOR = 1;
  public static final int LICENSEPLATE = 2;
  public static final int DESCRIPTION = 3;
  public static final int NAME = 4;
  public static final int HASAC = 5;

  public Vehicle(
      Color color,
      String licensePlate,
      String description,
      String name,
      Boolean hasAC) {
    this.color = color;
    this.licensePlate = licensePlate;
    this.description = description;
    this.name = name;
    this.hasAC = hasAC;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Vehicle(Vehicle other) {
    if (other.isSetColor()) {
      this.color = TBaseHelper.deepCopy(other.color);
    } else {
      this.color = null;
    }
    if (other.isSetLicensePlate()) {
      this.licensePlate = TBaseHelper.deepCopy(other.licensePlate);
    } else {
      this.licensePlate = null;
    }
    if (other.isSetDescription()) {
      this.description = TBaseHelper.deepCopy(other.description);
    } else {
      this.description = null;
    }
    if (other.isSetName()) {
      this.name = TBaseHelper.deepCopy(other.name);
    } else {
      this.name = null;
    }
    if (other.isSetHasAC()) {
      this.hasAC = TBaseHelper.deepCopy(other.hasAC);
    } else {
      this.hasAC = null;
    }
  }

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

  public Color getColor() {
    return this.color;
  }

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

  public String getLicensePlate() {
    return this.licensePlate;
  }

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

  public String getDescription() {
    return this.description;
  }

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

  public String getName() {
    return this.name;
  }

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

  public Boolean isHasAC() {
    return this.hasAC;
  }

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

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

    if (!TBaseHelper.equalsNobinary(this.isSetColor(), that.isSetColor(), this.color, that.color)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetLicensePlate(), that.isSetLicensePlate(), this.licensePlate, that.licensePlate)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetDescription(), that.isSetDescription(), this.description, that.description)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetName(), that.isSetName(), this.name, that.name)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetHasAC(), that.isSetHasAC(), this.hasAC, that.hasAC)) { return false; }

    return true;
  }

  @Override
  public int hashCode() {
    return Arrays.deepHashCode(new Object[] {color, licensePlate, description, name, hasAC});
  }

  // 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 Vehicle deserialize(TProtocol iprot) throws TException {
    Color tmp_color = null;
    String tmp_licensePlate = null;
    String tmp_description = null;
    String tmp_name = null;
    Boolean tmp_hasAC = null;
    TField __field;
    iprot.readStructBegin();
    while (true)
    {
      __field = iprot.readFieldBegin();
      if (__field.type == TType.STOP) {
        break;
      }
      switch (__field.id)
      {
        case COLOR:
          if (__field.type == TType.STRUCT) {
            tmp_color = Color.deserialize(iprot);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case LICENSEPLATE:
          if (__field.type == TType.STRING) {
            tmp_licensePlate = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case DESCRIPTION:
          if (__field.type == TType.STRING) {
            tmp_description = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case NAME:
          if (__field.type == TType.STRING) {
            tmp_name = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case HASAC:
          if (__field.type == TType.BOOL) {
            tmp_hasAC = iprot.readBool();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, __field.type);
          break;
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    Vehicle _that;
    _that = new Vehicle(
      tmp_color
      ,tmp_licensePlate
      ,tmp_description
      ,tmp_name
      ,tmp_hasAC
    );
    _that.validate();
    return _that;
  }

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

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.color != null) {
      oprot.writeFieldBegin(COLOR_FIELD_DESC);
      this.color.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.licensePlate != null) {
      if (isSetLicensePlate()) {
        oprot.writeFieldBegin(LICENSE_PLATE_FIELD_DESC);
        oprot.writeString(this.licensePlate);
        oprot.writeFieldEnd();
      }
    }
    if (this.description != null) {
      if (isSetDescription()) {
        oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
        oprot.writeString(this.description);
        oprot.writeFieldEnd();
      }
    }
    if (this.name != null) {
      if (isSetName()) {
        oprot.writeFieldBegin(NAME_FIELD_DESC);
        oprot.writeString(this.name);
        oprot.writeFieldEnd();
      }
    }
    if (this.hasAC != null) {
      if (isSetHasAC()) {
        oprot.writeFieldBegin(HAS_AC_FIELD_DESC);
        oprot.writeBool(this.hasAC);
        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
  }

}

