Subversion Repositories SmartDukaan

Rev

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.catalog;

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;

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

  private static final org.apache.thrift.protocol.TField SKU_FIELD_DESC = new org.apache.thrift.protocol.TField("sku", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField STANDARD_PRICE_FIELD_DESC = new org.apache.thrift.protocol.TField("standardPrice", org.apache.thrift.protocol.TType.DOUBLE, (short)2);
  private static final org.apache.thrift.protocol.TField SALE_PRICE_FIELD_DESC = new org.apache.thrift.protocol.TField("salePrice", org.apache.thrift.protocol.TType.DOUBLE, (short)3);
  private static final org.apache.thrift.protocol.TField START_DATE_FIELD_DESC = new org.apache.thrift.protocol.TField("startDate", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField END_DATE_FIELD_DESC = new org.apache.thrift.protocol.TField("endDate", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField ADDED_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("addedOn", org.apache.thrift.protocol.TType.I64, (short)6);
  private static final org.apache.thrift.protocol.TField UPDATED_ON_MARKETPLACE_FIELD_DESC = new org.apache.thrift.protocol.TField("updatedOnMarketplace", org.apache.thrift.protocol.TType.I64, (short)7);
  private static final org.apache.thrift.protocol.TField STATE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("stateId", org.apache.thrift.protocol.TType.I64, (short)8);
  private static final org.apache.thrift.protocol.TField PROMOTION_ACTIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionActive", org.apache.thrift.protocol.TType.BOOL, (short)9);
  private static final org.apache.thrift.protocol.TField SUBSIDY_AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("subsidyAmount", org.apache.thrift.protocol.TType.DOUBLE, (short)10);
  private static final org.apache.thrift.protocol.TField PROMOTION_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionType", org.apache.thrift.protocol.TType.I32, (short)11);

  private String sku; // required
  private double standardPrice; // required
  private double salePrice; // required
  private long startDate; // required
  private long endDate; // required
  private long addedOn; // required
  private long updatedOnMarketplace; // required
  private long stateId; // required
  private boolean promotionActive; // required
  private double subsidyAmount; // required
  private AmazonPromotionType promotionType; // 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 {
    SKU((short)1, "sku"),
    STANDARD_PRICE((short)2, "standardPrice"),
    SALE_PRICE((short)3, "salePrice"),
    START_DATE((short)4, "startDate"),
    END_DATE((short)5, "endDate"),
    ADDED_ON((short)6, "addedOn"),
    UPDATED_ON_MARKETPLACE((short)7, "updatedOnMarketplace"),
    STATE_ID((short)8, "stateId"),
    PROMOTION_ACTIVE((short)9, "promotionActive"),
    SUBSIDY_AMOUNT((short)10, "subsidyAmount"),
    /**
     * 
     * @see AmazonPromotionType
     */
    PROMOTION_TYPE((short)11, "promotionType");

    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: // SKU
          return SKU;
        case 2: // STANDARD_PRICE
          return STANDARD_PRICE;
        case 3: // SALE_PRICE
          return SALE_PRICE;
        case 4: // START_DATE
          return START_DATE;
        case 5: // END_DATE
          return END_DATE;
        case 6: // ADDED_ON
          return ADDED_ON;
        case 7: // UPDATED_ON_MARKETPLACE
          return UPDATED_ON_MARKETPLACE;
        case 8: // STATE_ID
          return STATE_ID;
        case 9: // PROMOTION_ACTIVE
          return PROMOTION_ACTIVE;
        case 10: // SUBSIDY_AMOUNT
          return SUBSIDY_AMOUNT;
        case 11: // PROMOTION_TYPE
          return PROMOTION_TYPE;
        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 __STANDARDPRICE_ISSET_ID = 0;
  private static final int __SALEPRICE_ISSET_ID = 1;
  private static final int __STARTDATE_ISSET_ID = 2;
  private static final int __ENDDATE_ISSET_ID = 3;
  private static final int __ADDEDON_ISSET_ID = 4;
  private static final int __UPDATEDONMARKETPLACE_ISSET_ID = 5;
  private static final int __STATEID_ISSET_ID = 6;
  private static final int __PROMOTIONACTIVE_ISSET_ID = 7;
  private static final int __SUBSIDYAMOUNT_ISSET_ID = 8;
  private BitSet __isset_bit_vector = new BitSet(9);

  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.SKU, new org.apache.thrift.meta_data.FieldMetaData("sku", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.STANDARD_PRICE, new org.apache.thrift.meta_data.FieldMetaData("standardPrice", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.SALE_PRICE, new org.apache.thrift.meta_data.FieldMetaData("salePrice", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.START_DATE, new org.apache.thrift.meta_data.FieldMetaData("startDate", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.END_DATE, new org.apache.thrift.meta_data.FieldMetaData("endDate", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ADDED_ON, new org.apache.thrift.meta_data.FieldMetaData("addedOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.UPDATED_ON_MARKETPLACE, new org.apache.thrift.meta_data.FieldMetaData("updatedOnMarketplace", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.STATE_ID, new org.apache.thrift.meta_data.FieldMetaData("stateId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.PROMOTION_ACTIVE, new org.apache.thrift.meta_data.FieldMetaData("promotionActive", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.SUBSIDY_AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("subsidyAmount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.PROMOTION_TYPE, new org.apache.thrift.meta_data.FieldMetaData("promotionType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, AmazonPromotionType.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AmazonPromotion.class, metaDataMap);
  }

  public AmazonPromotion() {
  }

  public AmazonPromotion(
    String sku,
    double standardPrice,
    double salePrice,
    long startDate,
    long endDate,
    long addedOn,
    long updatedOnMarketplace,
    long stateId,
    boolean promotionActive,
    double subsidyAmount,
    AmazonPromotionType promotionType)
  {
    this();
    this.sku = sku;
    this.standardPrice = standardPrice;
    setStandardPriceIsSet(true);
    this.salePrice = salePrice;
    setSalePriceIsSet(true);
    this.startDate = startDate;
    setStartDateIsSet(true);
    this.endDate = endDate;
    setEndDateIsSet(true);
    this.addedOn = addedOn;
    setAddedOnIsSet(true);
    this.updatedOnMarketplace = updatedOnMarketplace;
    setUpdatedOnMarketplaceIsSet(true);
    this.stateId = stateId;
    setStateIdIsSet(true);
    this.promotionActive = promotionActive;
    setPromotionActiveIsSet(true);
    this.subsidyAmount = subsidyAmount;
    setSubsidyAmountIsSet(true);
    this.promotionType = promotionType;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public AmazonPromotion(AmazonPromotion other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    if (other.isSetSku()) {
      this.sku = other.sku;
    }
    this.standardPrice = other.standardPrice;
    this.salePrice = other.salePrice;
    this.startDate = other.startDate;
    this.endDate = other.endDate;
    this.addedOn = other.addedOn;
    this.updatedOnMarketplace = other.updatedOnMarketplace;
    this.stateId = other.stateId;
    this.promotionActive = other.promotionActive;
    this.subsidyAmount = other.subsidyAmount;
    if (other.isSetPromotionType()) {
      this.promotionType = other.promotionType;
    }
  }

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

  @Override
  public void clear() {
    this.sku = null;
    setStandardPriceIsSet(false);
    this.standardPrice = 0.0;
    setSalePriceIsSet(false);
    this.salePrice = 0.0;
    setStartDateIsSet(false);
    this.startDate = 0;
    setEndDateIsSet(false);
    this.endDate = 0;
    setAddedOnIsSet(false);
    this.addedOn = 0;
    setUpdatedOnMarketplaceIsSet(false);
    this.updatedOnMarketplace = 0;
    setStateIdIsSet(false);
    this.stateId = 0;
    setPromotionActiveIsSet(false);
    this.promotionActive = false;
    setSubsidyAmountIsSet(false);
    this.subsidyAmount = 0.0;
    this.promotionType = null;
  }

  public String getSku() {
    return this.sku;
  }

  public void setSku(String sku) {
    this.sku = sku;
  }

  public void unsetSku() {
    this.sku = null;
  }

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

  public void setSkuIsSet(boolean value) {
    if (!value) {
      this.sku = null;
    }
  }

  public double getStandardPrice() {
    return this.standardPrice;
  }

  public void setStandardPrice(double standardPrice) {
    this.standardPrice = standardPrice;
    setStandardPriceIsSet(true);
  }

  public void unsetStandardPrice() {
    __isset_bit_vector.clear(__STANDARDPRICE_ISSET_ID);
  }

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

  public void setStandardPriceIsSet(boolean value) {
    __isset_bit_vector.set(__STANDARDPRICE_ISSET_ID, value);
  }

  public double getSalePrice() {
    return this.salePrice;
  }

  public void setSalePrice(double salePrice) {
    this.salePrice = salePrice;
    setSalePriceIsSet(true);
  }

  public void unsetSalePrice() {
    __isset_bit_vector.clear(__SALEPRICE_ISSET_ID);
  }

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

  public void setSalePriceIsSet(boolean value) {
    __isset_bit_vector.set(__SALEPRICE_ISSET_ID, value);
  }

  public long getStartDate() {
    return this.startDate;
  }

  public void setStartDate(long startDate) {
    this.startDate = startDate;
    setStartDateIsSet(true);
  }

  public void unsetStartDate() {
    __isset_bit_vector.clear(__STARTDATE_ISSET_ID);
  }

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

  public void setStartDateIsSet(boolean value) {
    __isset_bit_vector.set(__STARTDATE_ISSET_ID, value);
  }

  public long getEndDate() {
    return this.endDate;
  }

  public void setEndDate(long endDate) {
    this.endDate = endDate;
    setEndDateIsSet(true);
  }

  public void unsetEndDate() {
    __isset_bit_vector.clear(__ENDDATE_ISSET_ID);
  }

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

  public void setEndDateIsSet(boolean value) {
    __isset_bit_vector.set(__ENDDATE_ISSET_ID, value);
  }

  public long getAddedOn() {
    return this.addedOn;
  }

  public void setAddedOn(long addedOn) {
    this.addedOn = addedOn;
    setAddedOnIsSet(true);
  }

  public void unsetAddedOn() {
    __isset_bit_vector.clear(__ADDEDON_ISSET_ID);
  }

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

  public void setAddedOnIsSet(boolean value) {
    __isset_bit_vector.set(__ADDEDON_ISSET_ID, value);
  }

  public long getUpdatedOnMarketplace() {
    return this.updatedOnMarketplace;
  }

  public void setUpdatedOnMarketplace(long updatedOnMarketplace) {
    this.updatedOnMarketplace = updatedOnMarketplace;
    setUpdatedOnMarketplaceIsSet(true);
  }

  public void unsetUpdatedOnMarketplace() {
    __isset_bit_vector.clear(__UPDATEDONMARKETPLACE_ISSET_ID);
  }

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

  public void setUpdatedOnMarketplaceIsSet(boolean value) {
    __isset_bit_vector.set(__UPDATEDONMARKETPLACE_ISSET_ID, value);
  }

  public long getStateId() {
    return this.stateId;
  }

  public void setStateId(long stateId) {
    this.stateId = stateId;
    setStateIdIsSet(true);
  }

  public void unsetStateId() {
    __isset_bit_vector.clear(__STATEID_ISSET_ID);
  }

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

  public void setStateIdIsSet(boolean value) {
    __isset_bit_vector.set(__STATEID_ISSET_ID, value);
  }

  public boolean isPromotionActive() {
    return this.promotionActive;
  }

  public void setPromotionActive(boolean promotionActive) {
    this.promotionActive = promotionActive;
    setPromotionActiveIsSet(true);
  }

  public void unsetPromotionActive() {
    __isset_bit_vector.clear(__PROMOTIONACTIVE_ISSET_ID);
  }

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

  public void setPromotionActiveIsSet(boolean value) {
    __isset_bit_vector.set(__PROMOTIONACTIVE_ISSET_ID, value);
  }

  public double getSubsidyAmount() {
    return this.subsidyAmount;
  }

  public void setSubsidyAmount(double subsidyAmount) {
    this.subsidyAmount = subsidyAmount;
    setSubsidyAmountIsSet(true);
  }

  public void unsetSubsidyAmount() {
    __isset_bit_vector.clear(__SUBSIDYAMOUNT_ISSET_ID);
  }

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

  public void setSubsidyAmountIsSet(boolean value) {
    __isset_bit_vector.set(__SUBSIDYAMOUNT_ISSET_ID, value);
  }

  /**
   * 
   * @see AmazonPromotionType
   */
  public AmazonPromotionType getPromotionType() {
    return this.promotionType;
  }

  /**
   * 
   * @see AmazonPromotionType
   */
  public void setPromotionType(AmazonPromotionType promotionType) {
    this.promotionType = promotionType;
  }

  public void unsetPromotionType() {
    this.promotionType = null;
  }

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

  public void setPromotionTypeIsSet(boolean value) {
    if (!value) {
      this.promotionType = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case SKU:
      if (value == null) {
        unsetSku();
      } else {
        setSku((String)value);
      }
      break;

    case STANDARD_PRICE:
      if (value == null) {
        unsetStandardPrice();
      } else {
        setStandardPrice((Double)value);
      }
      break;

    case SALE_PRICE:
      if (value == null) {
        unsetSalePrice();
      } else {
        setSalePrice((Double)value);
      }
      break;

    case START_DATE:
      if (value == null) {
        unsetStartDate();
      } else {
        setStartDate((Long)value);
      }
      break;

    case END_DATE:
      if (value == null) {
        unsetEndDate();
      } else {
        setEndDate((Long)value);
      }
      break;

    case ADDED_ON:
      if (value == null) {
        unsetAddedOn();
      } else {
        setAddedOn((Long)value);
      }
      break;

    case UPDATED_ON_MARKETPLACE:
      if (value == null) {
        unsetUpdatedOnMarketplace();
      } else {
        setUpdatedOnMarketplace((Long)value);
      }
      break;

    case STATE_ID:
      if (value == null) {
        unsetStateId();
      } else {
        setStateId((Long)value);
      }
      break;

    case PROMOTION_ACTIVE:
      if (value == null) {
        unsetPromotionActive();
      } else {
        setPromotionActive((Boolean)value);
      }
      break;

    case SUBSIDY_AMOUNT:
      if (value == null) {
        unsetSubsidyAmount();
      } else {
        setSubsidyAmount((Double)value);
      }
      break;

    case PROMOTION_TYPE:
      if (value == null) {
        unsetPromotionType();
      } else {
        setPromotionType((AmazonPromotionType)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case SKU:
      return getSku();

    case STANDARD_PRICE:
      return Double.valueOf(getStandardPrice());

    case SALE_PRICE:
      return Double.valueOf(getSalePrice());

    case START_DATE:
      return Long.valueOf(getStartDate());

    case END_DATE:
      return Long.valueOf(getEndDate());

    case ADDED_ON:
      return Long.valueOf(getAddedOn());

    case UPDATED_ON_MARKETPLACE:
      return Long.valueOf(getUpdatedOnMarketplace());

    case STATE_ID:
      return Long.valueOf(getStateId());

    case PROMOTION_ACTIVE:
      return Boolean.valueOf(isPromotionActive());

    case SUBSIDY_AMOUNT:
      return Double.valueOf(getSubsidyAmount());

    case PROMOTION_TYPE:
      return getPromotionType();

    }
    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 SKU:
      return isSetSku();
    case STANDARD_PRICE:
      return isSetStandardPrice();
    case SALE_PRICE:
      return isSetSalePrice();
    case START_DATE:
      return isSetStartDate();
    case END_DATE:
      return isSetEndDate();
    case ADDED_ON:
      return isSetAddedOn();
    case UPDATED_ON_MARKETPLACE:
      return isSetUpdatedOnMarketplace();
    case STATE_ID:
      return isSetStateId();
    case PROMOTION_ACTIVE:
      return isSetPromotionActive();
    case SUBSIDY_AMOUNT:
      return isSetSubsidyAmount();
    case PROMOTION_TYPE:
      return isSetPromotionType();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_sku = true && this.isSetSku();
    boolean that_present_sku = true && that.isSetSku();
    if (this_present_sku || that_present_sku) {
      if (!(this_present_sku && that_present_sku))
        return false;
      if (!this.sku.equals(that.sku))
        return false;
    }

    boolean this_present_standardPrice = true;
    boolean that_present_standardPrice = true;
    if (this_present_standardPrice || that_present_standardPrice) {
      if (!(this_present_standardPrice && that_present_standardPrice))
        return false;
      if (this.standardPrice != that.standardPrice)
        return false;
    }

    boolean this_present_salePrice = true;
    boolean that_present_salePrice = true;
    if (this_present_salePrice || that_present_salePrice) {
      if (!(this_present_salePrice && that_present_salePrice))
        return false;
      if (this.salePrice != that.salePrice)
        return false;
    }

    boolean this_present_startDate = true;
    boolean that_present_startDate = true;
    if (this_present_startDate || that_present_startDate) {
      if (!(this_present_startDate && that_present_startDate))
        return false;
      if (this.startDate != that.startDate)
        return false;
    }

    boolean this_present_endDate = true;
    boolean that_present_endDate = true;
    if (this_present_endDate || that_present_endDate) {
      if (!(this_present_endDate && that_present_endDate))
        return false;
      if (this.endDate != that.endDate)
        return false;
    }

    boolean this_present_addedOn = true;
    boolean that_present_addedOn = true;
    if (this_present_addedOn || that_present_addedOn) {
      if (!(this_present_addedOn && that_present_addedOn))
        return false;
      if (this.addedOn != that.addedOn)
        return false;
    }

    boolean this_present_updatedOnMarketplace = true;
    boolean that_present_updatedOnMarketplace = true;
    if (this_present_updatedOnMarketplace || that_present_updatedOnMarketplace) {
      if (!(this_present_updatedOnMarketplace && that_present_updatedOnMarketplace))
        return false;
      if (this.updatedOnMarketplace != that.updatedOnMarketplace)
        return false;
    }

    boolean this_present_stateId = true;
    boolean that_present_stateId = true;
    if (this_present_stateId || that_present_stateId) {
      if (!(this_present_stateId && that_present_stateId))
        return false;
      if (this.stateId != that.stateId)
        return false;
    }

    boolean this_present_promotionActive = true;
    boolean that_present_promotionActive = true;
    if (this_present_promotionActive || that_present_promotionActive) {
      if (!(this_present_promotionActive && that_present_promotionActive))
        return false;
      if (this.promotionActive != that.promotionActive)
        return false;
    }

    boolean this_present_subsidyAmount = true;
    boolean that_present_subsidyAmount = true;
    if (this_present_subsidyAmount || that_present_subsidyAmount) {
      if (!(this_present_subsidyAmount && that_present_subsidyAmount))
        return false;
      if (this.subsidyAmount != that.subsidyAmount)
        return false;
    }

    boolean this_present_promotionType = true && this.isSetPromotionType();
    boolean that_present_promotionType = true && that.isSetPromotionType();
    if (this_present_promotionType || that_present_promotionType) {
      if (!(this_present_promotionType && that_present_promotionType))
        return false;
      if (!this.promotionType.equals(that.promotionType))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetSku()).compareTo(typedOther.isSetSku());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSku()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sku, typedOther.sku);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStandardPrice()).compareTo(typedOther.isSetStandardPrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStandardPrice()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.standardPrice, typedOther.standardPrice);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSalePrice()).compareTo(typedOther.isSetSalePrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSalePrice()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.salePrice, typedOther.salePrice);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStartDate()).compareTo(typedOther.isSetStartDate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStartDate()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startDate, typedOther.startDate);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEndDate()).compareTo(typedOther.isSetEndDate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEndDate()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.endDate, typedOther.endDate);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAddedOn()).compareTo(typedOther.isSetAddedOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAddedOn()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.addedOn, typedOther.addedOn);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUpdatedOnMarketplace()).compareTo(typedOther.isSetUpdatedOnMarketplace());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUpdatedOnMarketplace()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updatedOnMarketplace, typedOther.updatedOnMarketplace);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStateId()).compareTo(typedOther.isSetStateId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStateId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stateId, typedOther.stateId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPromotionActive()).compareTo(typedOther.isSetPromotionActive());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPromotionActive()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionActive, typedOther.promotionActive);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSubsidyAmount()).compareTo(typedOther.isSetSubsidyAmount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSubsidyAmount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.subsidyAmount, typedOther.subsidyAmount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPromotionType()).compareTo(typedOther.isSetPromotionType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPromotionType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionType, typedOther.promotionType);
      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: // SKU
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.sku = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // STANDARD_PRICE
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.standardPrice = iprot.readDouble();
            setStandardPriceIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // SALE_PRICE
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.salePrice = iprot.readDouble();
            setSalePriceIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // START_DATE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.startDate = iprot.readI64();
            setStartDateIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // END_DATE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.endDate = iprot.readI64();
            setEndDateIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // ADDED_ON
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.addedOn = iprot.readI64();
            setAddedOnIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // UPDATED_ON_MARKETPLACE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.updatedOnMarketplace = iprot.readI64();
            setUpdatedOnMarketplaceIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // STATE_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.stateId = iprot.readI64();
            setStateIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // PROMOTION_ACTIVE
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.promotionActive = iprot.readBool();
            setPromotionActiveIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // SUBSIDY_AMOUNT
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.subsidyAmount = iprot.readDouble();
            setSubsidyAmountIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 11: // PROMOTION_TYPE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.promotionType = AmazonPromotionType.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);
    if (this.sku != null) {
      oprot.writeFieldBegin(SKU_FIELD_DESC);
      oprot.writeString(this.sku);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(STANDARD_PRICE_FIELD_DESC);
    oprot.writeDouble(this.standardPrice);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(SALE_PRICE_FIELD_DESC);
    oprot.writeDouble(this.salePrice);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(START_DATE_FIELD_DESC);
    oprot.writeI64(this.startDate);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(END_DATE_FIELD_DESC);
    oprot.writeI64(this.endDate);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ADDED_ON_FIELD_DESC);
    oprot.writeI64(this.addedOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(UPDATED_ON_MARKETPLACE_FIELD_DESC);
    oprot.writeI64(this.updatedOnMarketplace);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(STATE_ID_FIELD_DESC);
    oprot.writeI64(this.stateId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(PROMOTION_ACTIVE_FIELD_DESC);
    oprot.writeBool(this.promotionActive);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(SUBSIDY_AMOUNT_FIELD_DESC);
    oprot.writeDouble(this.subsidyAmount);
    oprot.writeFieldEnd();
    if (this.promotionType != null) {
      oprot.writeFieldBegin(PROMOTION_TYPE_FIELD_DESC);
      oprot.writeI32(this.promotionType.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("sku:");
    if (this.sku == null) {
      sb.append("null");
    } else {
      sb.append(this.sku);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("standardPrice:");
    sb.append(this.standardPrice);
    first = false;
    if (!first) sb.append(", ");
    sb.append("salePrice:");
    sb.append(this.salePrice);
    first = false;
    if (!first) sb.append(", ");
    sb.append("startDate:");
    sb.append(this.startDate);
    first = false;
    if (!first) sb.append(", ");
    sb.append("endDate:");
    sb.append(this.endDate);
    first = false;
    if (!first) sb.append(", ");
    sb.append("addedOn:");
    sb.append(this.addedOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("updatedOnMarketplace:");
    sb.append(this.updatedOnMarketplace);
    first = false;
    if (!first) sb.append(", ");
    sb.append("stateId:");
    sb.append(this.stateId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("promotionActive:");
    sb.append(this.promotionActive);
    first = false;
    if (!first) sb.append(", ");
    sb.append("subsidyAmount:");
    sb.append(this.subsidyAmount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("promotionType:");
    if (this.promotionType == null) {
      sb.append("null");
    } else {
      sb.append(this.promotionType);
    }
    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);
    }
  }

}