Subversion Repositories SmartDukaan

Rev

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

/**
 * Autogenerated by Thrift
 *
 * 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.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.thrift.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.protocol.*;

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

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

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

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements 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<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      return byId.get(fieldId);
    }

    /**
     * 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, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.LAST_LOGIN, new FieldMetaData("lastLogin", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.LAST_LOGOUT, new FieldMetaData("lastLogout", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.EMAIL_VERIFICATION_SENT_ON, new FieldMetaData("emailVerificationSentOn", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.SMS_VERIFICATION_SENT_ON, new FieldMetaData("smsVerificationSentOn", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.IS_EMAIL_VERIFIED, new FieldMetaData("isEmailVerified", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
    put(_Fields.IS_SMSVERIFIED, new FieldMetaData("isSMSVerified", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
    put(_Fields.ACTIVE_SINCE, new FieldMetaData("activeSince", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.IPS, new FieldMetaData("ips", TFieldRequirementType.DEFAULT, 
        new ListMetaData(TType.LIST, 
            new StructMetaData(TType.STRUCT, IPMap.class))));
    put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
        new EnumMetaData(TType.ENUM, AccountStatus.class)));
  }});

  static {
    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);
  }

  @Deprecated
  public UserState clone() {
    return new UserState(this);
  }

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

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

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

  /** Returns true if field userId is set (has been asigned 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 UserState setLastLogin(long lastLogin) {
    this.lastLogin = lastLogin;
    setLastLoginIsSet(true);
    return this;
  }

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

  /** Returns true if field lastLogin is set (has been asigned 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 UserState setLastLogout(long lastLogout) {
    this.lastLogout = lastLogout;
    setLastLogoutIsSet(true);
    return this;
  }

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

  /** Returns true if field lastLogout is set (has been asigned 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 UserState setEmailVerificationSentOn(long emailVerificationSentOn) {
    this.emailVerificationSentOn = emailVerificationSentOn;
    setEmailVerificationSentOnIsSet(true);
    return this;
  }

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

  /** Returns true if field emailVerificationSentOn is set (has been asigned 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 UserState setSmsVerificationSentOn(long smsVerificationSentOn) {
    this.smsVerificationSentOn = smsVerificationSentOn;
    setSmsVerificationSentOnIsSet(true);
    return this;
  }

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

  /** Returns true if field smsVerificationSentOn is set (has been asigned 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 UserState setIsEmailVerified(boolean isEmailVerified) {
    this.isEmailVerified = isEmailVerified;
    setIsEmailVerifiedIsSet(true);
    return this;
  }

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

  /** Returns true if field isEmailVerified is set (has been asigned 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 UserState setIsSMSVerified(boolean isSMSVerified) {
    this.isSMSVerified = isSMSVerified;
    setIsSMSVerifiedIsSet(true);
    return this;
  }

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

  /** Returns true if field isSMSVerified is set (has been asigned 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 UserState setActiveSince(long activeSince) {
    this.activeSince = activeSince;
    setActiveSinceIsSet(true);
    return this;
  }

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

  /** Returns true if field activeSince is set (has been asigned 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 UserState setIps(List<IPMap> ips) {
    this.ips = ips;
    return this;
  }

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

  /** Returns true if field ips is set (has been asigned 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 UserState setStatus(AccountStatus status) {
    this.status = status;
    return this;
  }

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

  /** Returns true if field status is set (has been asigned 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 void setFieldValue(int fieldID, Object value) {
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
  }

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

    case LAST_LOGIN:
      return new Long(getLastLogin());

    case LAST_LOGOUT:
      return new Long(getLastLogout());

    case EMAIL_VERIFICATION_SENT_ON:
      return new Long(getEmailVerificationSentOn());

    case SMS_VERIFICATION_SENT_ON:
      return new Long(getSmsVerificationSentOn());

    case IS_EMAIL_VERIFIED:
      return new Boolean(isIsEmailVerified());

    case IS_SMSVERIFIED:
      return new Boolean(isIsSMSVerified());

    case ACTIVE_SINCE:
      return new Long(getActiveSince());

    case IPS:
      return getIps();

    case STATUS:
      return getStatus();

    }
    throw new IllegalStateException();
  }

  public Object getFieldValue(int fieldId) {
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
  }

  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    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();
  }

  public boolean isSet(int fieldID) {
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
  }

  @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(isSetUserId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(userId, typedOther.userId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetLastLogin()).compareTo(isSetLastLogin());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(lastLogin, typedOther.lastLogin);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetLastLogout()).compareTo(isSetLastLogout());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(lastLogout, typedOther.lastLogout);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetEmailVerificationSentOn()).compareTo(isSetEmailVerificationSentOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(emailVerificationSentOn, typedOther.emailVerificationSentOn);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetSmsVerificationSentOn()).compareTo(isSetSmsVerificationSentOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(smsVerificationSentOn, typedOther.smsVerificationSentOn);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetIsEmailVerified()).compareTo(isSetIsEmailVerified());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(isEmailVerified, typedOther.isEmailVerified);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetIsSMSVerified()).compareTo(isSetIsSMSVerified());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(isSMSVerified, typedOther.isSMSVerified);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetActiveSince()).compareTo(isSetActiveSince());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(activeSince, typedOther.activeSince);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetIps()).compareTo(isSetIps());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(ips, typedOther.ips);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(isSetStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(status, typedOther.status);
    if (lastComparison != 0) {
      return lastComparison;
    }
    return 0;
  }

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

  public void write(TProtocol oprot) throws 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 TList(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 {
      String status_name = status.name();
      if (status_name != null) {
        sb.append(status_name);
        sb.append(" (");
      }
      sb.append(this.status);
      if (status_name != null) {
        sb.append(")");
      }
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

}