Subversion Repositories SmartDukaan

Rev

Rev 1013 | Blame | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift Compiler (0.7.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.model.v1.user;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * dynamic user state
 * *
 */
public class UserState implements org.apache.thrift.TBase<UserState, UserState._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserState");

  private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField LAST_LOGIN_FIELD_DESC = new org.apache.thrift.protocol.TField("lastLogin", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField LAST_LOGOUT_FIELD_DESC = new org.apache.thrift.protocol.TField("lastLogout", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField EMAIL_VERIFICATION_SENT_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("emailVerificationSentOn", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField SMS_VERIFICATION_SENT_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("smsVerificationSentOn", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField IS_EMAIL_VERIFIED_FIELD_DESC = new org.apache.thrift.protocol.TField("isEmailVerified", org.apache.thrift.protocol.TType.BOOL, (short)6);
  private static final org.apache.thrift.protocol.TField IS_SMSVERIFIED_FIELD_DESC = new org.apache.thrift.protocol.TField("isSMSVerified", org.apache.thrift.protocol.TType.BOOL, (short)7);
  private static final org.apache.thrift.protocol.TField ACTIVE_SINCE_FIELD_DESC = new org.apache.thrift.protocol.TField("activeSince", org.apache.thrift.protocol.TType.I64, (short)8);
  private static final org.apache.thrift.protocol.TField IPS_FIELD_DESC = new org.apache.thrift.protocol.TField("ips", org.apache.thrift.protocol.TType.LIST, (short)9);
  private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.I32, (short)10);

  private long userId; // required
  private long lastLogin; // required
  private long lastLogout; // required
  private long emailVerificationSentOn; // required
  private long smsVerificationSentOn; // required
  private boolean isEmailVerified; // required
  private boolean isSMSVerified; // required
  private long activeSince; // required
  private List<IPMap> ips; // required
  private AccountStatus status; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    USER_ID((short)1, "userId"),
    LAST_LOGIN((short)2, "lastLogin"),
    LAST_LOGOUT((short)3, "lastLogout"),
    EMAIL_VERIFICATION_SENT_ON((short)4, "emailVerificationSentOn"),
    SMS_VERIFICATION_SENT_ON((short)5, "smsVerificationSentOn"),
    IS_EMAIL_VERIFIED((short)6, "isEmailVerified"),
    IS_SMSVERIFIED((short)7, "isSMSVerified"),
    ACTIVE_SINCE((short)8, "activeSince"),
    IPS((short)9, "ips"),
    /**
     * 
     * @see AccountStatus
     */
    STATUS((short)10, "status");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // USER_ID
          return USER_ID;
        case 2: // LAST_LOGIN
          return LAST_LOGIN;
        case 3: // LAST_LOGOUT
          return LAST_LOGOUT;
        case 4: // EMAIL_VERIFICATION_SENT_ON
          return EMAIL_VERIFICATION_SENT_ON;
        case 5: // SMS_VERIFICATION_SENT_ON
          return SMS_VERIFICATION_SENT_ON;
        case 6: // IS_EMAIL_VERIFIED
          return IS_EMAIL_VERIFIED;
        case 7: // IS_SMSVERIFIED
          return IS_SMSVERIFIED;
        case 8: // ACTIVE_SINCE
          return ACTIVE_SINCE;
        case 9: // IPS
          return IPS;
        case 10: // STATUS
          return STATUS;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __USERID_ISSET_ID = 0;
  private static final int __LASTLOGIN_ISSET_ID = 1;
  private static final int __LASTLOGOUT_ISSET_ID = 2;
  private static final int __EMAILVERIFICATIONSENTON_ISSET_ID = 3;
  private static final int __SMSVERIFICATIONSENTON_ISSET_ID = 4;
  private static final int __ISEMAILVERIFIED_ISSET_ID = 5;
  private static final int __ISSMSVERIFIED_ISSET_ID = 6;
  private static final int __ACTIVESINCE_ISSET_ID = 7;
  private BitSet __isset_bit_vector = new BitSet(8);

  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.LAST_LOGIN, new org.apache.thrift.meta_data.FieldMetaData("lastLogin", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.LAST_LOGOUT, new org.apache.thrift.meta_data.FieldMetaData("lastLogout", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.EMAIL_VERIFICATION_SENT_ON, new org.apache.thrift.meta_data.FieldMetaData("emailVerificationSentOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SMS_VERIFICATION_SENT_ON, new org.apache.thrift.meta_data.FieldMetaData("smsVerificationSentOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.IS_EMAIL_VERIFIED, new org.apache.thrift.meta_data.FieldMetaData("isEmailVerified", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.IS_SMSVERIFIED, new org.apache.thrift.meta_data.FieldMetaData("isSMSVerified", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.ACTIVE_SINCE, new org.apache.thrift.meta_data.FieldMetaData("activeSince", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.IPS, new org.apache.thrift.meta_data.FieldMetaData("ips", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, IPMap.class))));
    tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, AccountStatus.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserState.class, metaDataMap);
  }

  public UserState() {
  }

  public UserState(
    long userId,
    long lastLogin,
    long lastLogout,
    long emailVerificationSentOn,
    long smsVerificationSentOn,
    boolean isEmailVerified,
    boolean isSMSVerified,
    long activeSince,
    List<IPMap> ips,
    AccountStatus status)
  {
    this();
    this.userId = userId;
    setUserIdIsSet(true);
    this.lastLogin = lastLogin;
    setLastLoginIsSet(true);
    this.lastLogout = lastLogout;
    setLastLogoutIsSet(true);
    this.emailVerificationSentOn = emailVerificationSentOn;
    setEmailVerificationSentOnIsSet(true);
    this.smsVerificationSentOn = smsVerificationSentOn;
    setSmsVerificationSentOnIsSet(true);
    this.isEmailVerified = isEmailVerified;
    setIsEmailVerifiedIsSet(true);
    this.isSMSVerified = isSMSVerified;
    setIsSMSVerifiedIsSet(true);
    this.activeSince = activeSince;
    setActiveSinceIsSet(true);
    this.ips = ips;
    this.status = status;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public UserState(UserState other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.userId = other.userId;
    this.lastLogin = other.lastLogin;
    this.lastLogout = other.lastLogout;
    this.emailVerificationSentOn = other.emailVerificationSentOn;
    this.smsVerificationSentOn = other.smsVerificationSentOn;
    this.isEmailVerified = other.isEmailVerified;
    this.isSMSVerified = other.isSMSVerified;
    this.activeSince = other.activeSince;
    if (other.isSetIps()) {
      List<IPMap> __this__ips = new ArrayList<IPMap>();
      for (IPMap other_element : other.ips) {
        __this__ips.add(new IPMap(other_element));
      }
      this.ips = __this__ips;
    }
    if (other.isSetStatus()) {
      this.status = other.status;
    }
  }

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

  @Override
  public void clear() {
    setUserIdIsSet(false);
    this.userId = 0;
    setLastLoginIsSet(false);
    this.lastLogin = 0;
    setLastLogoutIsSet(false);
    this.lastLogout = 0;
    setEmailVerificationSentOnIsSet(false);
    this.emailVerificationSentOn = 0;
    setSmsVerificationSentOnIsSet(false);
    this.smsVerificationSentOn = 0;
    setIsEmailVerifiedIsSet(false);
    this.isEmailVerified = false;
    setIsSMSVerifiedIsSet(false);
    this.isSMSVerified = false;
    setActiveSinceIsSet(false);
    this.activeSince = 0;
    this.ips = null;
    this.status = null;
  }

  public long getUserId() {
    return this.userId;
  }

  public void setUserId(long userId) {
    this.userId = userId;
    setUserIdIsSet(true);
  }

  public void unsetUserId() {
    __isset_bit_vector.clear(__USERID_ISSET_ID);
  }

  /** Returns true if field userId is set (has been assigned a value) and false otherwise */
  public boolean isSetUserId() {
    return __isset_bit_vector.get(__USERID_ISSET_ID);
  }

  public void setUserIdIsSet(boolean value) {
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
  }

  public long getLastLogin() {
    return this.lastLogin;
  }

  public void setLastLogin(long lastLogin) {
    this.lastLogin = lastLogin;
    setLastLoginIsSet(true);
  }

  public void unsetLastLogin() {
    __isset_bit_vector.clear(__LASTLOGIN_ISSET_ID);
  }

  /** Returns true if field lastLogin is set (has been assigned a value) and false otherwise */
  public boolean isSetLastLogin() {
    return __isset_bit_vector.get(__LASTLOGIN_ISSET_ID);
  }

  public void setLastLoginIsSet(boolean value) {
    __isset_bit_vector.set(__LASTLOGIN_ISSET_ID, value);
  }

  public long getLastLogout() {
    return this.lastLogout;
  }

  public void setLastLogout(long lastLogout) {
    this.lastLogout = lastLogout;
    setLastLogoutIsSet(true);
  }

  public void unsetLastLogout() {
    __isset_bit_vector.clear(__LASTLOGOUT_ISSET_ID);
  }

  /** Returns true if field lastLogout is set (has been assigned a value) and false otherwise */
  public boolean isSetLastLogout() {
    return __isset_bit_vector.get(__LASTLOGOUT_ISSET_ID);
  }

  public void setLastLogoutIsSet(boolean value) {
    __isset_bit_vector.set(__LASTLOGOUT_ISSET_ID, value);
  }

  public long getEmailVerificationSentOn() {
    return this.emailVerificationSentOn;
  }

  public void setEmailVerificationSentOn(long emailVerificationSentOn) {
    this.emailVerificationSentOn = emailVerificationSentOn;
    setEmailVerificationSentOnIsSet(true);
  }

  public void unsetEmailVerificationSentOn() {
    __isset_bit_vector.clear(__EMAILVERIFICATIONSENTON_ISSET_ID);
  }

  /** Returns true if field emailVerificationSentOn is set (has been assigned a value) and false otherwise */
  public boolean isSetEmailVerificationSentOn() {
    return __isset_bit_vector.get(__EMAILVERIFICATIONSENTON_ISSET_ID);
  }

  public void setEmailVerificationSentOnIsSet(boolean value) {
    __isset_bit_vector.set(__EMAILVERIFICATIONSENTON_ISSET_ID, value);
  }

  public long getSmsVerificationSentOn() {
    return this.smsVerificationSentOn;
  }

  public void setSmsVerificationSentOn(long smsVerificationSentOn) {
    this.smsVerificationSentOn = smsVerificationSentOn;
    setSmsVerificationSentOnIsSet(true);
  }

  public void unsetSmsVerificationSentOn() {
    __isset_bit_vector.clear(__SMSVERIFICATIONSENTON_ISSET_ID);
  }

  /** Returns true if field smsVerificationSentOn is set (has been assigned a value) and false otherwise */
  public boolean isSetSmsVerificationSentOn() {
    return __isset_bit_vector.get(__SMSVERIFICATIONSENTON_ISSET_ID);
  }

  public void setSmsVerificationSentOnIsSet(boolean value) {
    __isset_bit_vector.set(__SMSVERIFICATIONSENTON_ISSET_ID, value);
  }

  public boolean isIsEmailVerified() {
    return this.isEmailVerified;
  }

  public void setIsEmailVerified(boolean isEmailVerified) {
    this.isEmailVerified = isEmailVerified;
    setIsEmailVerifiedIsSet(true);
  }

  public void unsetIsEmailVerified() {
    __isset_bit_vector.clear(__ISEMAILVERIFIED_ISSET_ID);
  }

  /** Returns true if field isEmailVerified is set (has been assigned a value) and false otherwise */
  public boolean isSetIsEmailVerified() {
    return __isset_bit_vector.get(__ISEMAILVERIFIED_ISSET_ID);
  }

  public void setIsEmailVerifiedIsSet(boolean value) {
    __isset_bit_vector.set(__ISEMAILVERIFIED_ISSET_ID, value);
  }

  public boolean isIsSMSVerified() {
    return this.isSMSVerified;
  }

  public void setIsSMSVerified(boolean isSMSVerified) {
    this.isSMSVerified = isSMSVerified;
    setIsSMSVerifiedIsSet(true);
  }

  public void unsetIsSMSVerified() {
    __isset_bit_vector.clear(__ISSMSVERIFIED_ISSET_ID);
  }

  /** Returns true if field isSMSVerified is set (has been assigned a value) and false otherwise */
  public boolean isSetIsSMSVerified() {
    return __isset_bit_vector.get(__ISSMSVERIFIED_ISSET_ID);
  }

  public void setIsSMSVerifiedIsSet(boolean value) {
    __isset_bit_vector.set(__ISSMSVERIFIED_ISSET_ID, value);
  }

  public long getActiveSince() {
    return this.activeSince;
  }

  public void setActiveSince(long activeSince) {
    this.activeSince = activeSince;
    setActiveSinceIsSet(true);
  }

  public void unsetActiveSince() {
    __isset_bit_vector.clear(__ACTIVESINCE_ISSET_ID);
  }

  /** Returns true if field activeSince is set (has been assigned a value) and false otherwise */
  public boolean isSetActiveSince() {
    return __isset_bit_vector.get(__ACTIVESINCE_ISSET_ID);
  }

  public void setActiveSinceIsSet(boolean value) {
    __isset_bit_vector.set(__ACTIVESINCE_ISSET_ID, value);
  }

  public int getIpsSize() {
    return (this.ips == null) ? 0 : this.ips.size();
  }

  public java.util.Iterator<IPMap> getIpsIterator() {
    return (this.ips == null) ? null : this.ips.iterator();
  }

  public void addToIps(IPMap elem) {
    if (this.ips == null) {
      this.ips = new ArrayList<IPMap>();
    }
    this.ips.add(elem);
  }

  public List<IPMap> getIps() {
    return this.ips;
  }

  public void setIps(List<IPMap> ips) {
    this.ips = ips;
  }

  public void unsetIps() {
    this.ips = null;
  }

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

  public void setIpsIsSet(boolean value) {
    if (!value) {
      this.ips = null;
    }
  }

  /**
   * 
   * @see AccountStatus
   */
  public AccountStatus getStatus() {
    return this.status;
  }

  /**
   * 
   * @see AccountStatus
   */
  public void setStatus(AccountStatus status) {
    this.status = status;
  }

  public void unsetStatus() {
    this.status = null;
  }

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

  public void setStatusIsSet(boolean value) {
    if (!value) {
      this.status = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case USER_ID:
      if (value == null) {
        unsetUserId();
      } else {
        setUserId((Long)value);
      }
      break;

    case LAST_LOGIN:
      if (value == null) {
        unsetLastLogin();
      } else {
        setLastLogin((Long)value);
      }
      break;

    case LAST_LOGOUT:
      if (value == null) {
        unsetLastLogout();
      } else {
        setLastLogout((Long)value);
      }
      break;

    case EMAIL_VERIFICATION_SENT_ON:
      if (value == null) {
        unsetEmailVerificationSentOn();
      } else {
        setEmailVerificationSentOn((Long)value);
      }
      break;

    case SMS_VERIFICATION_SENT_ON:
      if (value == null) {
        unsetSmsVerificationSentOn();
      } else {
        setSmsVerificationSentOn((Long)value);
      }
      break;

    case IS_EMAIL_VERIFIED:
      if (value == null) {
        unsetIsEmailVerified();
      } else {
        setIsEmailVerified((Boolean)value);
      }
      break;

    case IS_SMSVERIFIED:
      if (value == null) {
        unsetIsSMSVerified();
      } else {
        setIsSMSVerified((Boolean)value);
      }
      break;

    case ACTIVE_SINCE:
      if (value == null) {
        unsetActiveSince();
      } else {
        setActiveSince((Long)value);
      }
      break;

    case IPS:
      if (value == null) {
        unsetIps();
      } else {
        setIps((List<IPMap>)value);
      }
      break;

    case STATUS:
      if (value == null) {
        unsetStatus();
      } else {
        setStatus((AccountStatus)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case USER_ID:
      return Long.valueOf(getUserId());

    case LAST_LOGIN:
      return Long.valueOf(getLastLogin());

    case LAST_LOGOUT:
      return Long.valueOf(getLastLogout());

    case EMAIL_VERIFICATION_SENT_ON:
      return Long.valueOf(getEmailVerificationSentOn());

    case SMS_VERIFICATION_SENT_ON:
      return Long.valueOf(getSmsVerificationSentOn());

    case IS_EMAIL_VERIFIED:
      return Boolean.valueOf(isIsEmailVerified());

    case IS_SMSVERIFIED:
      return Boolean.valueOf(isIsSMSVerified());

    case ACTIVE_SINCE:
      return Long.valueOf(getActiveSince());

    case IPS:
      return getIps();

    case STATUS:
      return getStatus();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case USER_ID:
      return isSetUserId();
    case LAST_LOGIN:
      return isSetLastLogin();
    case LAST_LOGOUT:
      return isSetLastLogout();
    case EMAIL_VERIFICATION_SENT_ON:
      return isSetEmailVerificationSentOn();
    case SMS_VERIFICATION_SENT_ON:
      return isSetSmsVerificationSentOn();
    case IS_EMAIL_VERIFIED:
      return isSetIsEmailVerified();
    case IS_SMSVERIFIED:
      return isSetIsSMSVerified();
    case ACTIVE_SINCE:
      return isSetActiveSince();
    case IPS:
      return isSetIps();
    case STATUS:
      return isSetStatus();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof UserState)
      return this.equals((UserState)that);
    return false;
  }

  public boolean equals(UserState that) {
    if (that == null)
      return false;

    boolean this_present_userId = true;
    boolean that_present_userId = true;
    if (this_present_userId || that_present_userId) {
      if (!(this_present_userId && that_present_userId))
        return false;
      if (this.userId != that.userId)
        return false;
    }

    boolean this_present_lastLogin = true;
    boolean that_present_lastLogin = true;
    if (this_present_lastLogin || that_present_lastLogin) {
      if (!(this_present_lastLogin && that_present_lastLogin))
        return false;
      if (this.lastLogin != that.lastLogin)
        return false;
    }

    boolean this_present_lastLogout = true;
    boolean that_present_lastLogout = true;
    if (this_present_lastLogout || that_present_lastLogout) {
      if (!(this_present_lastLogout && that_present_lastLogout))
        return false;
      if (this.lastLogout != that.lastLogout)
        return false;
    }

    boolean this_present_emailVerificationSentOn = true;
    boolean that_present_emailVerificationSentOn = true;
    if (this_present_emailVerificationSentOn || that_present_emailVerificationSentOn) {
      if (!(this_present_emailVerificationSentOn && that_present_emailVerificationSentOn))
        return false;
      if (this.emailVerificationSentOn != that.emailVerificationSentOn)
        return false;
    }

    boolean this_present_smsVerificationSentOn = true;
    boolean that_present_smsVerificationSentOn = true;
    if (this_present_smsVerificationSentOn || that_present_smsVerificationSentOn) {
      if (!(this_present_smsVerificationSentOn && that_present_smsVerificationSentOn))
        return false;
      if (this.smsVerificationSentOn != that.smsVerificationSentOn)
        return false;
    }

    boolean this_present_isEmailVerified = true;
    boolean that_present_isEmailVerified = true;
    if (this_present_isEmailVerified || that_present_isEmailVerified) {
      if (!(this_present_isEmailVerified && that_present_isEmailVerified))
        return false;
      if (this.isEmailVerified != that.isEmailVerified)
        return false;
    }

    boolean this_present_isSMSVerified = true;
    boolean that_present_isSMSVerified = true;
    if (this_present_isSMSVerified || that_present_isSMSVerified) {
      if (!(this_present_isSMSVerified && that_present_isSMSVerified))
        return false;
      if (this.isSMSVerified != that.isSMSVerified)
        return false;
    }

    boolean this_present_activeSince = true;
    boolean that_present_activeSince = true;
    if (this_present_activeSince || that_present_activeSince) {
      if (!(this_present_activeSince && that_present_activeSince))
        return false;
      if (this.activeSince != that.activeSince)
        return false;
    }

    boolean this_present_ips = true && this.isSetIps();
    boolean that_present_ips = true && that.isSetIps();
    if (this_present_ips || that_present_ips) {
      if (!(this_present_ips && that_present_ips))
        return false;
      if (!this.ips.equals(that.ips))
        return false;
    }

    boolean this_present_status = true && this.isSetStatus();
    boolean that_present_status = true && that.isSetStatus();
    if (this_present_status || that_present_status) {
      if (!(this_present_status && that_present_status))
        return false;
      if (!this.status.equals(that.status))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

  public int compareTo(UserState other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    UserState typedOther = (UserState)other;

    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUserId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLastLogin()).compareTo(typedOther.isSetLastLogin());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLastLogin()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastLogin, typedOther.lastLogin);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLastLogout()).compareTo(typedOther.isSetLastLogout());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLastLogout()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastLogout, typedOther.lastLogout);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEmailVerificationSentOn()).compareTo(typedOther.isSetEmailVerificationSentOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEmailVerificationSentOn()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.emailVerificationSentOn, typedOther.emailVerificationSentOn);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSmsVerificationSentOn()).compareTo(typedOther.isSetSmsVerificationSentOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSmsVerificationSentOn()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.smsVerificationSentOn, typedOther.smsVerificationSentOn);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsEmailVerified()).compareTo(typedOther.isSetIsEmailVerified());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsEmailVerified()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isEmailVerified, typedOther.isEmailVerified);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsSMSVerified()).compareTo(typedOther.isSetIsSMSVerified());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsSMSVerified()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isSMSVerified, typedOther.isSMSVerified);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetActiveSince()).compareTo(typedOther.isSetActiveSince());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetActiveSince()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.activeSince, typedOther.activeSince);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIps()).compareTo(typedOther.isSetIps());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIps()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ips, typedOther.ips);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
        break;
      }
      switch (field.id) {
        case 1: // USER_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.userId = iprot.readI64();
            setUserIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // LAST_LOGIN
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.lastLogin = iprot.readI64();
            setLastLoginIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // LAST_LOGOUT
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.lastLogout = iprot.readI64();
            setLastLogoutIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // EMAIL_VERIFICATION_SENT_ON
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.emailVerificationSentOn = iprot.readI64();
            setEmailVerificationSentOnIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // SMS_VERIFICATION_SENT_ON
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.smsVerificationSentOn = iprot.readI64();
            setSmsVerificationSentOnIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // IS_EMAIL_VERIFIED
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.isEmailVerified = iprot.readBool();
            setIsEmailVerifiedIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // IS_SMSVERIFIED
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.isSMSVerified = iprot.readBool();
            setIsSMSVerifiedIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // ACTIVE_SINCE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.activeSince = iprot.readI64();
            setActiveSinceIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // IPS
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
              this.ips = new ArrayList<IPMap>(_list0.size);
              for (int _i1 = 0; _i1 < _list0.size; ++_i1)
              {
                IPMap _elem2; // required
                _elem2 = new IPMap();
                _elem2.read(iprot);
                this.ips.add(_elem2);
              }
              iprot.readListEnd();
            }
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // STATUS
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.status = AccountStatus.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
    oprot.writeI64(this.userId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(LAST_LOGIN_FIELD_DESC);
    oprot.writeI64(this.lastLogin);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(LAST_LOGOUT_FIELD_DESC);
    oprot.writeI64(this.lastLogout);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(EMAIL_VERIFICATION_SENT_ON_FIELD_DESC);
    oprot.writeI64(this.emailVerificationSentOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(SMS_VERIFICATION_SENT_ON_FIELD_DESC);
    oprot.writeI64(this.smsVerificationSentOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(IS_EMAIL_VERIFIED_FIELD_DESC);
    oprot.writeBool(this.isEmailVerified);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(IS_SMSVERIFIED_FIELD_DESC);
    oprot.writeBool(this.isSMSVerified);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ACTIVE_SINCE_FIELD_DESC);
    oprot.writeI64(this.activeSince);
    oprot.writeFieldEnd();
    if (this.ips != null) {
      oprot.writeFieldBegin(IPS_FIELD_DESC);
      {
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.ips.size()));
        for (IPMap _iter3 : this.ips)
        {
          _iter3.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.status != null) {
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
      oprot.writeI32(this.status.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("UserState(");
    boolean first = true;

    sb.append("userId:");
    sb.append(this.userId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("lastLogin:");
    sb.append(this.lastLogin);
    first = false;
    if (!first) sb.append(", ");
    sb.append("lastLogout:");
    sb.append(this.lastLogout);
    first = false;
    if (!first) sb.append(", ");
    sb.append("emailVerificationSentOn:");
    sb.append(this.emailVerificationSentOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("smsVerificationSentOn:");
    sb.append(this.smsVerificationSentOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("isEmailVerified:");
    sb.append(this.isEmailVerified);
    first = false;
    if (!first) sb.append(", ");
    sb.append("isSMSVerified:");
    sb.append(this.isSMSVerified);
    first = false;
    if (!first) sb.append(", ");
    sb.append("activeSince:");
    sb.append(this.activeSince);
    first = false;
    if (!first) sb.append(", ");
    sb.append("ips:");
    if (this.ips == null) {
      sb.append("null");
    } else {
      sb.append(this.ips);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("status:");
    if (this.status == null) {
      sb.append("null");
    } else {
      sb.append(this.status);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bit_vector = new BitSet(1);
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

}