Subversion Repositories SmartDukaan

Rev

Rev 571 | Rev 614 | Go to most recent revision | Blame | Compare with Previous | 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.*;

public class Cart implements TBase<Cart._Fields>, java.io.Serializable, Cloneable, Comparable<Cart> {
  private static final TStruct STRUCT_DESC = new TStruct("Cart");

  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
  private static final TField LINES_FIELD_DESC = new TField("lines", TType.LIST, (short)2);
  private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)3);
  private static final TField CREATED_ON_FIELD_DESC = new TField("createdOn", TType.I64, (short)4);
  private static final TField UPDATED_ON_FIELD_DESC = new TField("updatedOn", TType.I64, (short)5);
  private static final TField COMMITTED_ON_FIELD_DESC = new TField("committedOn", TType.I64, (short)6);
  private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)7);
  private static final TField ADDRESS_ID_FIELD_DESC = new TField("addressId", TType.I64, (short)8);
  private static final TField ESTIMATE_FIELD_DESC = new TField("estimate", TType.I32, (short)9);

  private long id;
  private List<Line> lines;
  private CartStatus status;
  private long createdOn;
  private long updatedOn;
  private long committedOn;
  private long userId;
  private long addressId;
  private int estimate;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    ID((short)1, "id"),
    LINES((short)2, "lines"),
    /**
     * 
     * @see CartStatus
     */
    STATUS((short)3, "status"),
    CREATED_ON((short)4, "createdOn"),
    UPDATED_ON((short)5, "updatedOn"),
    COMMITTED_ON((short)6, "committedOn"),
    USER_ID((short)7, "userId"),
    ADDRESS_ID((short)8, "addressId"),
    ESTIMATE((short)9, "estimate");

    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 __ID_ISSET_ID = 0;
  private static final int __CREATEDON_ISSET_ID = 1;
  private static final int __UPDATEDON_ISSET_ID = 2;
  private static final int __COMMITTEDON_ISSET_ID = 3;
  private static final int __USERID_ISSET_ID = 4;
  private static final int __ADDRESSID_ISSET_ID = 5;
  private static final int __ESTIMATE_ISSET_ID = 6;
  private BitSet __isset_bit_vector = new BitSet(7);

  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.LINES, new FieldMetaData("lines", TFieldRequirementType.DEFAULT, 
        new ListMetaData(TType.LIST, 
            new StructMetaData(TType.STRUCT, Line.class))));
    put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
        new EnumMetaData(TType.ENUM, CartStatus.class)));
    put(_Fields.CREATED_ON, new FieldMetaData("createdOn", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.UPDATED_ON, new FieldMetaData("updatedOn", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.COMMITTED_ON, new FieldMetaData("committedOn", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ADDRESS_ID, new FieldMetaData("addressId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ESTIMATE, new FieldMetaData("estimate", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
  }});

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

  public Cart() {
  }

  public Cart(
    long id,
    List<Line> lines,
    CartStatus status,
    long createdOn,
    long updatedOn,
    long committedOn,
    long userId,
    long addressId,
    int estimate)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.lines = lines;
    this.status = status;
    this.createdOn = createdOn;
    setCreatedOnIsSet(true);
    this.updatedOn = updatedOn;
    setUpdatedOnIsSet(true);
    this.committedOn = committedOn;
    setCommittedOnIsSet(true);
    this.userId = userId;
    setUserIdIsSet(true);
    this.addressId = addressId;
    setAddressIdIsSet(true);
    this.estimate = estimate;
    setEstimateIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Cart(Cart other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    if (other.isSetLines()) {
      List<Line> __this__lines = new ArrayList<Line>();
      for (Line other_element : other.lines) {
        __this__lines.add(new Line(other_element));
      }
      this.lines = __this__lines;
    }
    if (other.isSetStatus()) {
      this.status = other.status;
    }
    this.createdOn = other.createdOn;
    this.updatedOn = other.updatedOn;
    this.committedOn = other.committedOn;
    this.userId = other.userId;
    this.addressId = other.addressId;
    this.estimate = other.estimate;
  }

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

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

  public long getId() {
    return this.id;
  }

  public Cart setId(long id) {
    this.id = id;
    setIdIsSet(true);
    return this;
  }

  public void unsetId() {
    __isset_bit_vector.clear(__ID_ISSET_ID);
  }

  /** Returns true if field id is set (has been asigned a value) and false otherwise */
  public boolean isSetId() {
    return __isset_bit_vector.get(__ID_ISSET_ID);
  }

  public void setIdIsSet(boolean value) {
    __isset_bit_vector.set(__ID_ISSET_ID, value);
  }

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

  public java.util.Iterator<Line> getLinesIterator() {
    return (this.lines == null) ? null : this.lines.iterator();
  }

  public void addToLines(Line elem) {
    if (this.lines == null) {
      this.lines = new ArrayList<Line>();
    }
    this.lines.add(elem);
  }

  public List<Line> getLines() {
    return this.lines;
  }

  public Cart setLines(List<Line> lines) {
    this.lines = lines;
    return this;
  }

  public void unsetLines() {
    this.lines = null;
  }

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

  public void setLinesIsSet(boolean value) {
    if (!value) {
      this.lines = null;
    }
  }

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

  /**
   * 
   * @see CartStatus
   */
  public Cart setStatus(CartStatus 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 long getCreatedOn() {
    return this.createdOn;
  }

  public Cart setCreatedOn(long createdOn) {
    this.createdOn = createdOn;
    setCreatedOnIsSet(true);
    return this;
  }

  public void unsetCreatedOn() {
    __isset_bit_vector.clear(__CREATEDON_ISSET_ID);
  }

  /** Returns true if field createdOn is set (has been asigned a value) and false otherwise */
  public boolean isSetCreatedOn() {
    return __isset_bit_vector.get(__CREATEDON_ISSET_ID);
  }

  public void setCreatedOnIsSet(boolean value) {
    __isset_bit_vector.set(__CREATEDON_ISSET_ID, value);
  }

  public long getUpdatedOn() {
    return this.updatedOn;
  }

  public Cart setUpdatedOn(long updatedOn) {
    this.updatedOn = updatedOn;
    setUpdatedOnIsSet(true);
    return this;
  }

  public void unsetUpdatedOn() {
    __isset_bit_vector.clear(__UPDATEDON_ISSET_ID);
  }

  /** Returns true if field updatedOn is set (has been asigned a value) and false otherwise */
  public boolean isSetUpdatedOn() {
    return __isset_bit_vector.get(__UPDATEDON_ISSET_ID);
  }

  public void setUpdatedOnIsSet(boolean value) {
    __isset_bit_vector.set(__UPDATEDON_ISSET_ID, value);
  }

  public long getCommittedOn() {
    return this.committedOn;
  }

  public Cart setCommittedOn(long committedOn) {
    this.committedOn = committedOn;
    setCommittedOnIsSet(true);
    return this;
  }

  public void unsetCommittedOn() {
    __isset_bit_vector.clear(__COMMITTEDON_ISSET_ID);
  }

  /** Returns true if field committedOn is set (has been asigned a value) and false otherwise */
  public boolean isSetCommittedOn() {
    return __isset_bit_vector.get(__COMMITTEDON_ISSET_ID);
  }

  public void setCommittedOnIsSet(boolean value) {
    __isset_bit_vector.set(__COMMITTEDON_ISSET_ID, value);
  }

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

  public Cart 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 getAddressId() {
    return this.addressId;
  }

  public Cart setAddressId(long addressId) {
    this.addressId = addressId;
    setAddressIdIsSet(true);
    return this;
  }

  public void unsetAddressId() {
    __isset_bit_vector.clear(__ADDRESSID_ISSET_ID);
  }

  /** Returns true if field addressId is set (has been asigned a value) and false otherwise */
  public boolean isSetAddressId() {
    return __isset_bit_vector.get(__ADDRESSID_ISSET_ID);
  }

  public void setAddressIdIsSet(boolean value) {
    __isset_bit_vector.set(__ADDRESSID_ISSET_ID, value);
  }

  public int getEstimate() {
    return this.estimate;
  }

  public Cart setEstimate(int estimate) {
    this.estimate = estimate;
    setEstimateIsSet(true);
    return this;
  }

  public void unsetEstimate() {
    __isset_bit_vector.clear(__ESTIMATE_ISSET_ID);
  }

  /** Returns true if field estimate is set (has been asigned a value) and false otherwise */
  public boolean isSetEstimate() {
    return __isset_bit_vector.get(__ESTIMATE_ISSET_ID);
  }

  public void setEstimateIsSet(boolean value) {
    __isset_bit_vector.set(__ESTIMATE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((Long)value);
      }
      break;

    case LINES:
      if (value == null) {
        unsetLines();
      } else {
        setLines((List<Line>)value);
      }
      break;

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

    case CREATED_ON:
      if (value == null) {
        unsetCreatedOn();
      } else {
        setCreatedOn((Long)value);
      }
      break;

    case UPDATED_ON:
      if (value == null) {
        unsetUpdatedOn();
      } else {
        setUpdatedOn((Long)value);
      }
      break;

    case COMMITTED_ON:
      if (value == null) {
        unsetCommittedOn();
      } else {
        setCommittedOn((Long)value);
      }
      break;

    case USER_ID:
      if (value == null) {
        unsetUserId();
      } else {
        setUserId((Long)value);
      }
      break;

    case ADDRESS_ID:
      if (value == null) {
        unsetAddressId();
      } else {
        setAddressId((Long)value);
      }
      break;

    case ESTIMATE:
      if (value == null) {
        unsetEstimate();
      } else {
        setEstimate((Integer)value);
      }
      break;

    }
  }

  public void setFieldValue(int fieldID, Object value) {
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ID:
      return new Long(getId());

    case LINES:
      return getLines();

    case STATUS:
      return getStatus();

    case CREATED_ON:
      return new Long(getCreatedOn());

    case UPDATED_ON:
      return new Long(getUpdatedOn());

    case COMMITTED_ON:
      return new Long(getCommittedOn());

    case USER_ID:
      return new Long(getUserId());

    case ADDRESS_ID:
      return new Long(getAddressId());

    case ESTIMATE:
      return new Integer(getEstimate());

    }
    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 ID:
      return isSetId();
    case LINES:
      return isSetLines();
    case STATUS:
      return isSetStatus();
    case CREATED_ON:
      return isSetCreatedOn();
    case UPDATED_ON:
      return isSetUpdatedOn();
    case COMMITTED_ON:
      return isSetCommittedOn();
    case USER_ID:
      return isSetUserId();
    case ADDRESS_ID:
      return isSetAddressId();
    case ESTIMATE:
      return isSetEstimate();
    }
    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 Cart)
      return this.equals((Cart)that);
    return false;
  }

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

    boolean this_present_id = true;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_lines = true && this.isSetLines();
    boolean that_present_lines = true && that.isSetLines();
    if (this_present_lines || that_present_lines) {
      if (!(this_present_lines && that_present_lines))
        return false;
      if (!this.lines.equals(that.lines))
        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;
    }

    boolean this_present_createdOn = true;
    boolean that_present_createdOn = true;
    if (this_present_createdOn || that_present_createdOn) {
      if (!(this_present_createdOn && that_present_createdOn))
        return false;
      if (this.createdOn != that.createdOn)
        return false;
    }

    boolean this_present_updatedOn = true;
    boolean that_present_updatedOn = true;
    if (this_present_updatedOn || that_present_updatedOn) {
      if (!(this_present_updatedOn && that_present_updatedOn))
        return false;
      if (this.updatedOn != that.updatedOn)
        return false;
    }

    boolean this_present_committedOn = true;
    boolean that_present_committedOn = true;
    if (this_present_committedOn || that_present_committedOn) {
      if (!(this_present_committedOn && that_present_committedOn))
        return false;
      if (this.committedOn != that.committedOn)
        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_addressId = true;
    boolean that_present_addressId = true;
    if (this_present_addressId || that_present_addressId) {
      if (!(this_present_addressId && that_present_addressId))
        return false;
      if (this.addressId != that.addressId)
        return false;
    }

    boolean this_present_estimate = true;
    boolean that_present_estimate = true;
    if (this_present_estimate || that_present_estimate) {
      if (!(this_present_estimate && that_present_estimate))
        return false;
      if (this.estimate != that.estimate)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetLines()).compareTo(isSetLines());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(lines, typedOther.lines);
    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;
    }
    lastComparison = Boolean.valueOf(isSetCreatedOn()).compareTo(isSetCreatedOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(createdOn, typedOther.createdOn);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetUpdatedOn()).compareTo(isSetUpdatedOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(updatedOn, typedOther.updatedOn);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCommittedOn()).compareTo(isSetCommittedOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(committedOn, typedOther.committedOn);
    if (lastComparison != 0) {
      return lastComparison;
    }
    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(isSetAddressId()).compareTo(isSetAddressId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(addressId, typedOther.addressId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetEstimate()).compareTo(isSetEstimate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(estimate, typedOther.estimate);
    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 ID:
            if (field.type == TType.I64) {
              this.id = iprot.readI64();
              setIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case LINES:
            if (field.type == TType.LIST) {
              {
                TList _list8 = iprot.readListBegin();
                this.lines = new ArrayList<Line>(_list8.size);
                for (int _i9 = 0; _i9 < _list8.size; ++_i9)
                {
                  Line _elem10;
                  _elem10 = new Line();
                  _elem10.read(iprot);
                  this.lines.add(_elem10);
                }
                iprot.readListEnd();
              }
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case STATUS:
            if (field.type == TType.I32) {
              this.status = CartStatus.findByValue(iprot.readI32());
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case CREATED_ON:
            if (field.type == TType.I64) {
              this.createdOn = iprot.readI64();
              setCreatedOnIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case UPDATED_ON:
            if (field.type == TType.I64) {
              this.updatedOn = iprot.readI64();
              setUpdatedOnIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case COMMITTED_ON:
            if (field.type == TType.I64) {
              this.committedOn = iprot.readI64();
              setCommittedOnIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case USER_ID:
            if (field.type == TType.I64) {
              this.userId = iprot.readI64();
              setUserIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ADDRESS_ID:
            if (field.type == TType.I64) {
              this.addressId = iprot.readI64();
              setAddressIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ESTIMATE:
            if (field.type == TType.I32) {
              this.estimate = iprot.readI32();
              setEstimateIsSet(true);
            } 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(ID_FIELD_DESC);
    oprot.writeI64(this.id);
    oprot.writeFieldEnd();
    if (this.lines != null) {
      oprot.writeFieldBegin(LINES_FIELD_DESC);
      {
        oprot.writeListBegin(new TList(TType.STRUCT, this.lines.size()));
        for (Line _iter11 : this.lines)
        {
          _iter11.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.status != null) {
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
      oprot.writeI32(this.status.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(CREATED_ON_FIELD_DESC);
    oprot.writeI64(this.createdOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(UPDATED_ON_FIELD_DESC);
    oprot.writeI64(this.updatedOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(COMMITTED_ON_FIELD_DESC);
    oprot.writeI64(this.committedOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
    oprot.writeI64(this.userId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ADDRESS_ID_FIELD_DESC);
    oprot.writeI64(this.addressId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ESTIMATE_FIELD_DESC);
    oprot.writeI32(this.estimate);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("lines:");
    if (this.lines == null) {
      sb.append("null");
    } else {
      sb.append(this.lines);
    }
    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;
    if (!first) sb.append(", ");
    sb.append("createdOn:");
    sb.append(this.createdOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("updatedOn:");
    sb.append(this.updatedOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("committedOn:");
    sb.append(this.committedOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("userId:");
    sb.append(this.userId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("addressId:");
    sb.append(this.addressId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("estimate:");
    sb.append(this.estimate);
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

}