Subversion Repositories SmartDukaan

Rev

Rev 22359 | Blame | Compare with Previous | Last modification | View Log | RSS feed

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

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

public class PromotionService {

  /**
   * Promotion Service
   */
  public interface Iface extends in.shop2020.generic.GenericService.Iface {

    public void createPromotion(String name, String ruleExecutionSrc, long startOn, long endOn) throws PromotionException, org.apache.thrift.TException;

    public long removeAllCouponsByPromotionId(long promotionId) throws PromotionException, org.apache.thrift.TException;

    public Coupon getCoupon(String couponCode) throws PromotionException, org.apache.thrift.TException;

    public boolean isGiftVoucher(String couponCode) throws PromotionException, org.apache.thrift.TException;

    public boolean isCodApplicable(Cart cart) throws PromotionException, org.apache.thrift.TException;

    public List<Promotion> getAllPromotions() throws PromotionException, org.apache.thrift.TException;

    public Promotion getPromotionById(long promotionId) throws PromotionException, org.apache.thrift.TException;

    public void generateCouponsForPromotion(long promotionId, String couponCode) throws PromotionException, org.apache.thrift.TException;

    public Cart applyCoupon(String couponCode, long cartId) throws PromotionException, org.apache.thrift.TException;

    public Map<Long,Double> getEmiDiscount(long cartId) throws PromotionException, org.apache.thrift.TException;

    public Map<Long,String> applyRechargeCoupon(String couponCode, long totalAmount, long userId) throws PromotionException, org.apache.thrift.TException;

    public void trackCouponUsage(String couponCode, long transactionId, long userId, long amount, boolean isDigital) throws PromotionException, org.apache.thrift.TException;

    public long getCouponUsageCountByUser(String couponCode, long userId) throws PromotionException, org.apache.thrift.TException;

    public List<Coupon> getActiveCodes(long promotionId) throws PromotionException, org.apache.thrift.TException;

    public void deleteCoupon(String couponCode) throws PromotionException, org.apache.thrift.TException;

    public List<Coupon> getAllCouponsByPromotionId(long promotionId) throws PromotionException, org.apache.thrift.TException;

    /**
     * Returns a list of active coupons
     */
    public List<Coupon> getActiveCoupons() throws PromotionException, org.apache.thrift.TException;

    /**
     * Creates a coupon with prefix (optional, pass null)and returns couponcode if successfully created.
     * 
     * @param promotionId
     * @param couponCategory
     * @param couponCode
     * @param arguments
     * @param isCod
     * @param prefix
     */
    public String createCoupon(long promotionId, long couponCategory, String couponCode, String arguments, boolean isCod, String prefix) throws PromotionException, org.apache.thrift.TException;

    /**
     * Returns the count of successful payments done using a given coupon
     * 
     * @param couponCode
     */
    public long getSuccessfulPaymentCountForCoupon(String couponCode) throws PromotionException, org.apache.thrift.TException;

    /**
     * Returns the doc string of the rule module
     * 
     * @param ruleName
     */
    public String getRuleDocString(String ruleName) throws org.apache.thrift.TException;

    public List<ItemCouponDiscount> getItemDiscountMap(List<Long> itemIds) throws PromotionException, org.apache.thrift.TException;

    public Map<String,Double> getDiscountsForEntity(long entityId) throws org.apache.thrift.TException;

    public void addVoucher(Voucher voucher) throws org.apache.thrift.TException;

    public Voucher assignVoucher(long userId, String userEmail, VoucherType voucherType, long amount) throws org.apache.thrift.TException;

    public boolean markVoucherAsRedeemed(String voucherCode, long redeemedOn) throws org.apache.thrift.TException;

  }

  public interface AsyncIface extends in.shop2020.generic.GenericService .AsyncIface {

    public void createPromotion(String name, String ruleExecutionSrc, long startOn, long endOn, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.createPromotion_call> resultHandler) throws org.apache.thrift.TException;

    public void removeAllCouponsByPromotionId(long promotionId, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.removeAllCouponsByPromotionId_call> resultHandler) throws org.apache.thrift.TException;

    public void getCoupon(String couponCode, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getCoupon_call> resultHandler) throws org.apache.thrift.TException;

    public void isGiftVoucher(String couponCode, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.isGiftVoucher_call> resultHandler) throws org.apache.thrift.TException;

    public void isCodApplicable(Cart cart, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.isCodApplicable_call> resultHandler) throws org.apache.thrift.TException;

    public void getAllPromotions(org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getAllPromotions_call> resultHandler) throws org.apache.thrift.TException;

    public void getPromotionById(long promotionId, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getPromotionById_call> resultHandler) throws org.apache.thrift.TException;

    public void generateCouponsForPromotion(long promotionId, String couponCode, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.generateCouponsForPromotion_call> resultHandler) throws org.apache.thrift.TException;

    public void applyCoupon(String couponCode, long cartId, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.applyCoupon_call> resultHandler) throws org.apache.thrift.TException;

    public void getEmiDiscount(long cartId, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getEmiDiscount_call> resultHandler) throws org.apache.thrift.TException;

    public void applyRechargeCoupon(String couponCode, long totalAmount, long userId, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.applyRechargeCoupon_call> resultHandler) throws org.apache.thrift.TException;

    public void trackCouponUsage(String couponCode, long transactionId, long userId, long amount, boolean isDigital, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.trackCouponUsage_call> resultHandler) throws org.apache.thrift.TException;

    public void getCouponUsageCountByUser(String couponCode, long userId, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getCouponUsageCountByUser_call> resultHandler) throws org.apache.thrift.TException;

    public void getActiveCodes(long promotionId, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getActiveCodes_call> resultHandler) throws org.apache.thrift.TException;

    public void deleteCoupon(String couponCode, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.deleteCoupon_call> resultHandler) throws org.apache.thrift.TException;

    public void getAllCouponsByPromotionId(long promotionId, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getAllCouponsByPromotionId_call> resultHandler) throws org.apache.thrift.TException;

    public void getActiveCoupons(org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getActiveCoupons_call> resultHandler) throws org.apache.thrift.TException;

    public void createCoupon(long promotionId, long couponCategory, String couponCode, String arguments, boolean isCod, String prefix, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.createCoupon_call> resultHandler) throws org.apache.thrift.TException;

    public void getSuccessfulPaymentCountForCoupon(String couponCode, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getSuccessfulPaymentCountForCoupon_call> resultHandler) throws org.apache.thrift.TException;

    public void getRuleDocString(String ruleName, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getRuleDocString_call> resultHandler) throws org.apache.thrift.TException;

    public void getItemDiscountMap(List<Long> itemIds, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getItemDiscountMap_call> resultHandler) throws org.apache.thrift.TException;

    public void getDiscountsForEntity(long entityId, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getDiscountsForEntity_call> resultHandler) throws org.apache.thrift.TException;

    public void addVoucher(Voucher voucher, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.addVoucher_call> resultHandler) throws org.apache.thrift.TException;

    public void assignVoucher(long userId, String userEmail, VoucherType voucherType, long amount, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.assignVoucher_call> resultHandler) throws org.apache.thrift.TException;

    public void markVoucherAsRedeemed(String voucherCode, long redeemedOn, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.markVoucherAsRedeemed_call> resultHandler) throws org.apache.thrift.TException;

  }

  public static class Client extends in.shop2020.generic.GenericService.Client implements Iface {
    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
      public Factory() {}
      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
        return new Client(prot);
      }
      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
        return new Client(iprot, oprot);
      }
    }

    public Client(org.apache.thrift.protocol.TProtocol prot)
    {
      super(prot, prot);
    }

    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
      super(iprot, oprot);
    }

    public void createPromotion(String name, String ruleExecutionSrc, long startOn, long endOn) throws PromotionException, org.apache.thrift.TException
    {
      send_createPromotion(name, ruleExecutionSrc, startOn, endOn);
      recv_createPromotion();
    }

    public void send_createPromotion(String name, String ruleExecutionSrc, long startOn, long endOn) throws org.apache.thrift.TException
    {
      createPromotion_args args = new createPromotion_args();
      args.setName(name);
      args.setRuleExecutionSrc(ruleExecutionSrc);
      args.setStartOn(startOn);
      args.setEndOn(endOn);
      sendBase("createPromotion", args);
    }

    public void recv_createPromotion() throws PromotionException, org.apache.thrift.TException
    {
      createPromotion_result result = new createPromotion_result();
      receiveBase(result, "createPromotion");
      if (result.pex != null) {
        throw result.pex;
      }
      return;
    }

    public long removeAllCouponsByPromotionId(long promotionId) throws PromotionException, org.apache.thrift.TException
    {
      send_removeAllCouponsByPromotionId(promotionId);
      return recv_removeAllCouponsByPromotionId();
    }

    public void send_removeAllCouponsByPromotionId(long promotionId) throws org.apache.thrift.TException
    {
      removeAllCouponsByPromotionId_args args = new removeAllCouponsByPromotionId_args();
      args.setPromotionId(promotionId);
      sendBase("removeAllCouponsByPromotionId", args);
    }

    public long recv_removeAllCouponsByPromotionId() throws PromotionException, org.apache.thrift.TException
    {
      removeAllCouponsByPromotionId_result result = new removeAllCouponsByPromotionId_result();
      receiveBase(result, "removeAllCouponsByPromotionId");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "removeAllCouponsByPromotionId failed: unknown result");
    }

    public Coupon getCoupon(String couponCode) throws PromotionException, org.apache.thrift.TException
    {
      send_getCoupon(couponCode);
      return recv_getCoupon();
    }

    public void send_getCoupon(String couponCode) throws org.apache.thrift.TException
    {
      getCoupon_args args = new getCoupon_args();
      args.setCouponCode(couponCode);
      sendBase("getCoupon", args);
    }

    public Coupon recv_getCoupon() throws PromotionException, org.apache.thrift.TException
    {
      getCoupon_result result = new getCoupon_result();
      receiveBase(result, "getCoupon");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getCoupon failed: unknown result");
    }

    public boolean isGiftVoucher(String couponCode) throws PromotionException, org.apache.thrift.TException
    {
      send_isGiftVoucher(couponCode);
      return recv_isGiftVoucher();
    }

    public void send_isGiftVoucher(String couponCode) throws org.apache.thrift.TException
    {
      isGiftVoucher_args args = new isGiftVoucher_args();
      args.setCouponCode(couponCode);
      sendBase("isGiftVoucher", args);
    }

    public boolean recv_isGiftVoucher() throws PromotionException, org.apache.thrift.TException
    {
      isGiftVoucher_result result = new isGiftVoucher_result();
      receiveBase(result, "isGiftVoucher");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "isGiftVoucher failed: unknown result");
    }

    public boolean isCodApplicable(Cart cart) throws PromotionException, org.apache.thrift.TException
    {
      send_isCodApplicable(cart);
      return recv_isCodApplicable();
    }

    public void send_isCodApplicable(Cart cart) throws org.apache.thrift.TException
    {
      isCodApplicable_args args = new isCodApplicable_args();
      args.setCart(cart);
      sendBase("isCodApplicable", args);
    }

    public boolean recv_isCodApplicable() throws PromotionException, org.apache.thrift.TException
    {
      isCodApplicable_result result = new isCodApplicable_result();
      receiveBase(result, "isCodApplicable");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "isCodApplicable failed: unknown result");
    }

    public List<Promotion> getAllPromotions() throws PromotionException, org.apache.thrift.TException
    {
      send_getAllPromotions();
      return recv_getAllPromotions();
    }

    public void send_getAllPromotions() throws org.apache.thrift.TException
    {
      getAllPromotions_args args = new getAllPromotions_args();
      sendBase("getAllPromotions", args);
    }

    public List<Promotion> recv_getAllPromotions() throws PromotionException, org.apache.thrift.TException
    {
      getAllPromotions_result result = new getAllPromotions_result();
      receiveBase(result, "getAllPromotions");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getAllPromotions failed: unknown result");
    }

    public Promotion getPromotionById(long promotionId) throws PromotionException, org.apache.thrift.TException
    {
      send_getPromotionById(promotionId);
      return recv_getPromotionById();
    }

    public void send_getPromotionById(long promotionId) throws org.apache.thrift.TException
    {
      getPromotionById_args args = new getPromotionById_args();
      args.setPromotionId(promotionId);
      sendBase("getPromotionById", args);
    }

    public Promotion recv_getPromotionById() throws PromotionException, org.apache.thrift.TException
    {
      getPromotionById_result result = new getPromotionById_result();
      receiveBase(result, "getPromotionById");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPromotionById failed: unknown result");
    }

    public void generateCouponsForPromotion(long promotionId, String couponCode) throws PromotionException, org.apache.thrift.TException
    {
      send_generateCouponsForPromotion(promotionId, couponCode);
      recv_generateCouponsForPromotion();
    }

    public void send_generateCouponsForPromotion(long promotionId, String couponCode) throws org.apache.thrift.TException
    {
      generateCouponsForPromotion_args args = new generateCouponsForPromotion_args();
      args.setPromotionId(promotionId);
      args.setCouponCode(couponCode);
      sendBase("generateCouponsForPromotion", args);
    }

    public void recv_generateCouponsForPromotion() throws PromotionException, org.apache.thrift.TException
    {
      generateCouponsForPromotion_result result = new generateCouponsForPromotion_result();
      receiveBase(result, "generateCouponsForPromotion");
      if (result.pex != null) {
        throw result.pex;
      }
      return;
    }

    public Cart applyCoupon(String couponCode, long cartId) throws PromotionException, org.apache.thrift.TException
    {
      send_applyCoupon(couponCode, cartId);
      return recv_applyCoupon();
    }

    public void send_applyCoupon(String couponCode, long cartId) throws org.apache.thrift.TException
    {
      applyCoupon_args args = new applyCoupon_args();
      args.setCouponCode(couponCode);
      args.setCartId(cartId);
      sendBase("applyCoupon", args);
    }

    public Cart recv_applyCoupon() throws PromotionException, org.apache.thrift.TException
    {
      applyCoupon_result result = new applyCoupon_result();
      receiveBase(result, "applyCoupon");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "applyCoupon failed: unknown result");
    }

    public Map<Long,Double> getEmiDiscount(long cartId) throws PromotionException, org.apache.thrift.TException
    {
      send_getEmiDiscount(cartId);
      return recv_getEmiDiscount();
    }

    public void send_getEmiDiscount(long cartId) throws org.apache.thrift.TException
    {
      getEmiDiscount_args args = new getEmiDiscount_args();
      args.setCartId(cartId);
      sendBase("getEmiDiscount", args);
    }

    public Map<Long,Double> recv_getEmiDiscount() throws PromotionException, org.apache.thrift.TException
    {
      getEmiDiscount_result result = new getEmiDiscount_result();
      receiveBase(result, "getEmiDiscount");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getEmiDiscount failed: unknown result");
    }

    public Map<Long,String> applyRechargeCoupon(String couponCode, long totalAmount, long userId) throws PromotionException, org.apache.thrift.TException
    {
      send_applyRechargeCoupon(couponCode, totalAmount, userId);
      return recv_applyRechargeCoupon();
    }

    public void send_applyRechargeCoupon(String couponCode, long totalAmount, long userId) throws org.apache.thrift.TException
    {
      applyRechargeCoupon_args args = new applyRechargeCoupon_args();
      args.setCouponCode(couponCode);
      args.setTotalAmount(totalAmount);
      args.setUserId(userId);
      sendBase("applyRechargeCoupon", args);
    }

    public Map<Long,String> recv_applyRechargeCoupon() throws PromotionException, org.apache.thrift.TException
    {
      applyRechargeCoupon_result result = new applyRechargeCoupon_result();
      receiveBase(result, "applyRechargeCoupon");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "applyRechargeCoupon failed: unknown result");
    }

    public void trackCouponUsage(String couponCode, long transactionId, long userId, long amount, boolean isDigital) throws PromotionException, org.apache.thrift.TException
    {
      send_trackCouponUsage(couponCode, transactionId, userId, amount, isDigital);
      recv_trackCouponUsage();
    }

    public void send_trackCouponUsage(String couponCode, long transactionId, long userId, long amount, boolean isDigital) throws org.apache.thrift.TException
    {
      trackCouponUsage_args args = new trackCouponUsage_args();
      args.setCouponCode(couponCode);
      args.setTransactionId(transactionId);
      args.setUserId(userId);
      args.setAmount(amount);
      args.setIsDigital(isDigital);
      sendBase("trackCouponUsage", args);
    }

    public void recv_trackCouponUsage() throws PromotionException, org.apache.thrift.TException
    {
      trackCouponUsage_result result = new trackCouponUsage_result();
      receiveBase(result, "trackCouponUsage");
      if (result.pex != null) {
        throw result.pex;
      }
      return;
    }

    public long getCouponUsageCountByUser(String couponCode, long userId) throws PromotionException, org.apache.thrift.TException
    {
      send_getCouponUsageCountByUser(couponCode, userId);
      return recv_getCouponUsageCountByUser();
    }

    public void send_getCouponUsageCountByUser(String couponCode, long userId) throws org.apache.thrift.TException
    {
      getCouponUsageCountByUser_args args = new getCouponUsageCountByUser_args();
      args.setCouponCode(couponCode);
      args.setUserId(userId);
      sendBase("getCouponUsageCountByUser", args);
    }

    public long recv_getCouponUsageCountByUser() throws PromotionException, org.apache.thrift.TException
    {
      getCouponUsageCountByUser_result result = new getCouponUsageCountByUser_result();
      receiveBase(result, "getCouponUsageCountByUser");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getCouponUsageCountByUser failed: unknown result");
    }

    public List<Coupon> getActiveCodes(long promotionId) throws PromotionException, org.apache.thrift.TException
    {
      send_getActiveCodes(promotionId);
      return recv_getActiveCodes();
    }

    public void send_getActiveCodes(long promotionId) throws org.apache.thrift.TException
    {
      getActiveCodes_args args = new getActiveCodes_args();
      args.setPromotionId(promotionId);
      sendBase("getActiveCodes", args);
    }

    public List<Coupon> recv_getActiveCodes() throws PromotionException, org.apache.thrift.TException
    {
      getActiveCodes_result result = new getActiveCodes_result();
      receiveBase(result, "getActiveCodes");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getActiveCodes failed: unknown result");
    }

    public void deleteCoupon(String couponCode) throws PromotionException, org.apache.thrift.TException
    {
      send_deleteCoupon(couponCode);
      recv_deleteCoupon();
    }

    public void send_deleteCoupon(String couponCode) throws org.apache.thrift.TException
    {
      deleteCoupon_args args = new deleteCoupon_args();
      args.setCouponCode(couponCode);
      sendBase("deleteCoupon", args);
    }

    public void recv_deleteCoupon() throws PromotionException, org.apache.thrift.TException
    {
      deleteCoupon_result result = new deleteCoupon_result();
      receiveBase(result, "deleteCoupon");
      if (result.pex != null) {
        throw result.pex;
      }
      return;
    }

    public List<Coupon> getAllCouponsByPromotionId(long promotionId) throws PromotionException, org.apache.thrift.TException
    {
      send_getAllCouponsByPromotionId(promotionId);
      return recv_getAllCouponsByPromotionId();
    }

    public void send_getAllCouponsByPromotionId(long promotionId) throws org.apache.thrift.TException
    {
      getAllCouponsByPromotionId_args args = new getAllCouponsByPromotionId_args();
      args.setPromotionId(promotionId);
      sendBase("getAllCouponsByPromotionId", args);
    }

    public List<Coupon> recv_getAllCouponsByPromotionId() throws PromotionException, org.apache.thrift.TException
    {
      getAllCouponsByPromotionId_result result = new getAllCouponsByPromotionId_result();
      receiveBase(result, "getAllCouponsByPromotionId");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getAllCouponsByPromotionId failed: unknown result");
    }

    public List<Coupon> getActiveCoupons() throws PromotionException, org.apache.thrift.TException
    {
      send_getActiveCoupons();
      return recv_getActiveCoupons();
    }

    public void send_getActiveCoupons() throws org.apache.thrift.TException
    {
      getActiveCoupons_args args = new getActiveCoupons_args();
      sendBase("getActiveCoupons", args);
    }

    public List<Coupon> recv_getActiveCoupons() throws PromotionException, org.apache.thrift.TException
    {
      getActiveCoupons_result result = new getActiveCoupons_result();
      receiveBase(result, "getActiveCoupons");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getActiveCoupons failed: unknown result");
    }

    public String createCoupon(long promotionId, long couponCategory, String couponCode, String arguments, boolean isCod, String prefix) throws PromotionException, org.apache.thrift.TException
    {
      send_createCoupon(promotionId, couponCategory, couponCode, arguments, isCod, prefix);
      return recv_createCoupon();
    }

    public void send_createCoupon(long promotionId, long couponCategory, String couponCode, String arguments, boolean isCod, String prefix) throws org.apache.thrift.TException
    {
      createCoupon_args args = new createCoupon_args();
      args.setPromotionId(promotionId);
      args.setCouponCategory(couponCategory);
      args.setCouponCode(couponCode);
      args.setArguments(arguments);
      args.setIsCod(isCod);
      args.setPrefix(prefix);
      sendBase("createCoupon", args);
    }

    public String recv_createCoupon() throws PromotionException, org.apache.thrift.TException
    {
      createCoupon_result result = new createCoupon_result();
      receiveBase(result, "createCoupon");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "createCoupon failed: unknown result");
    }

    public long getSuccessfulPaymentCountForCoupon(String couponCode) throws PromotionException, org.apache.thrift.TException
    {
      send_getSuccessfulPaymentCountForCoupon(couponCode);
      return recv_getSuccessfulPaymentCountForCoupon();
    }

    public void send_getSuccessfulPaymentCountForCoupon(String couponCode) throws org.apache.thrift.TException
    {
      getSuccessfulPaymentCountForCoupon_args args = new getSuccessfulPaymentCountForCoupon_args();
      args.setCouponCode(couponCode);
      sendBase("getSuccessfulPaymentCountForCoupon", args);
    }

    public long recv_getSuccessfulPaymentCountForCoupon() throws PromotionException, org.apache.thrift.TException
    {
      getSuccessfulPaymentCountForCoupon_result result = new getSuccessfulPaymentCountForCoupon_result();
      receiveBase(result, "getSuccessfulPaymentCountForCoupon");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getSuccessfulPaymentCountForCoupon failed: unknown result");
    }

    public String getRuleDocString(String ruleName) throws org.apache.thrift.TException
    {
      send_getRuleDocString(ruleName);
      return recv_getRuleDocString();
    }

    public void send_getRuleDocString(String ruleName) throws org.apache.thrift.TException
    {
      getRuleDocString_args args = new getRuleDocString_args();
      args.setRuleName(ruleName);
      sendBase("getRuleDocString", args);
    }

    public String recv_getRuleDocString() throws org.apache.thrift.TException
    {
      getRuleDocString_result result = new getRuleDocString_result();
      receiveBase(result, "getRuleDocString");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getRuleDocString failed: unknown result");
    }

    public List<ItemCouponDiscount> getItemDiscountMap(List<Long> itemIds) throws PromotionException, org.apache.thrift.TException
    {
      send_getItemDiscountMap(itemIds);
      return recv_getItemDiscountMap();
    }

    public void send_getItemDiscountMap(List<Long> itemIds) throws org.apache.thrift.TException
    {
      getItemDiscountMap_args args = new getItemDiscountMap_args();
      args.setItemIds(itemIds);
      sendBase("getItemDiscountMap", args);
    }

    public List<ItemCouponDiscount> recv_getItemDiscountMap() throws PromotionException, org.apache.thrift.TException
    {
      getItemDiscountMap_result result = new getItemDiscountMap_result();
      receiveBase(result, "getItemDiscountMap");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pex != null) {
        throw result.pex;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getItemDiscountMap failed: unknown result");
    }

    public Map<String,Double> getDiscountsForEntity(long entityId) throws org.apache.thrift.TException
    {
      send_getDiscountsForEntity(entityId);
      return recv_getDiscountsForEntity();
    }

    public void send_getDiscountsForEntity(long entityId) throws org.apache.thrift.TException
    {
      getDiscountsForEntity_args args = new getDiscountsForEntity_args();
      args.setEntityId(entityId);
      sendBase("getDiscountsForEntity", args);
    }

    public Map<String,Double> recv_getDiscountsForEntity() throws org.apache.thrift.TException
    {
      getDiscountsForEntity_result result = new getDiscountsForEntity_result();
      receiveBase(result, "getDiscountsForEntity");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getDiscountsForEntity failed: unknown result");
    }

    public void addVoucher(Voucher voucher) throws org.apache.thrift.TException
    {
      send_addVoucher(voucher);
      recv_addVoucher();
    }

    public void send_addVoucher(Voucher voucher) throws org.apache.thrift.TException
    {
      addVoucher_args args = new addVoucher_args();
      args.setVoucher(voucher);
      sendBase("addVoucher", args);
    }

    public void recv_addVoucher() throws org.apache.thrift.TException
    {
      addVoucher_result result = new addVoucher_result();
      receiveBase(result, "addVoucher");
      return;
    }

    public Voucher assignVoucher(long userId, String userEmail, VoucherType voucherType, long amount) throws org.apache.thrift.TException
    {
      send_assignVoucher(userId, userEmail, voucherType, amount);
      return recv_assignVoucher();
    }

    public void send_assignVoucher(long userId, String userEmail, VoucherType voucherType, long amount) throws org.apache.thrift.TException
    {
      assignVoucher_args args = new assignVoucher_args();
      args.setUserId(userId);
      args.setUserEmail(userEmail);
      args.setVoucherType(voucherType);
      args.setAmount(amount);
      sendBase("assignVoucher", args);
    }

    public Voucher recv_assignVoucher() throws org.apache.thrift.TException
    {
      assignVoucher_result result = new assignVoucher_result();
      receiveBase(result, "assignVoucher");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "assignVoucher failed: unknown result");
    }

    public boolean markVoucherAsRedeemed(String voucherCode, long redeemedOn) throws org.apache.thrift.TException
    {
      send_markVoucherAsRedeemed(voucherCode, redeemedOn);
      return recv_markVoucherAsRedeemed();
    }

    public void send_markVoucherAsRedeemed(String voucherCode, long redeemedOn) throws org.apache.thrift.TException
    {
      markVoucherAsRedeemed_args args = new markVoucherAsRedeemed_args();
      args.setVoucherCode(voucherCode);
      args.setRedeemedOn(redeemedOn);
      sendBase("markVoucherAsRedeemed", args);
    }

    public boolean recv_markVoucherAsRedeemed() throws org.apache.thrift.TException
    {
      markVoucherAsRedeemed_result result = new markVoucherAsRedeemed_result();
      receiveBase(result, "markVoucherAsRedeemed");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "markVoucherAsRedeemed failed: unknown result");
    }

  }
  public static class AsyncClient extends in.shop2020.generic.GenericService.AsyncClient implements AsyncIface {
    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
      private org.apache.thrift.async.TAsyncClientManager clientManager;
      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
        this.clientManager = clientManager;
        this.protocolFactory = protocolFactory;
      }
      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
        return new AsyncClient(protocolFactory, clientManager, transport);
      }
    }

    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
      super(protocolFactory, clientManager, transport);
    }

    public void createPromotion(String name, String ruleExecutionSrc, long startOn, long endOn, org.apache.thrift.async.AsyncMethodCallback<createPromotion_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      createPromotion_call method_call = new createPromotion_call(name, ruleExecutionSrc, startOn, endOn, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class createPromotion_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String name;
      private String ruleExecutionSrc;
      private long startOn;
      private long endOn;
      public createPromotion_call(String name, String ruleExecutionSrc, long startOn, long endOn, org.apache.thrift.async.AsyncMethodCallback<createPromotion_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.name = name;
        this.ruleExecutionSrc = ruleExecutionSrc;
        this.startOn = startOn;
        this.endOn = endOn;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("createPromotion", org.apache.thrift.protocol.TMessageType.CALL, 0));
        createPromotion_args args = new createPromotion_args();
        args.setName(name);
        args.setRuleExecutionSrc(ruleExecutionSrc);
        args.setStartOn(startOn);
        args.setEndOn(endOn);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_createPromotion();
      }
    }

    public void removeAllCouponsByPromotionId(long promotionId, org.apache.thrift.async.AsyncMethodCallback<removeAllCouponsByPromotionId_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      removeAllCouponsByPromotionId_call method_call = new removeAllCouponsByPromotionId_call(promotionId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class removeAllCouponsByPromotionId_call extends org.apache.thrift.async.TAsyncMethodCall {
      private long promotionId;
      public removeAllCouponsByPromotionId_call(long promotionId, org.apache.thrift.async.AsyncMethodCallback<removeAllCouponsByPromotionId_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.promotionId = promotionId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("removeAllCouponsByPromotionId", org.apache.thrift.protocol.TMessageType.CALL, 0));
        removeAllCouponsByPromotionId_args args = new removeAllCouponsByPromotionId_args();
        args.setPromotionId(promotionId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public long getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_removeAllCouponsByPromotionId();
      }
    }

    public void getCoupon(String couponCode, org.apache.thrift.async.AsyncMethodCallback<getCoupon_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getCoupon_call method_call = new getCoupon_call(couponCode, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getCoupon_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String couponCode;
      public getCoupon_call(String couponCode, org.apache.thrift.async.AsyncMethodCallback<getCoupon_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.couponCode = couponCode;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getCoupon", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getCoupon_args args = new getCoupon_args();
        args.setCouponCode(couponCode);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public Coupon getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getCoupon();
      }
    }

    public void isGiftVoucher(String couponCode, org.apache.thrift.async.AsyncMethodCallback<isGiftVoucher_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      isGiftVoucher_call method_call = new isGiftVoucher_call(couponCode, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class isGiftVoucher_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String couponCode;
      public isGiftVoucher_call(String couponCode, org.apache.thrift.async.AsyncMethodCallback<isGiftVoucher_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.couponCode = couponCode;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("isGiftVoucher", org.apache.thrift.protocol.TMessageType.CALL, 0));
        isGiftVoucher_args args = new isGiftVoucher_args();
        args.setCouponCode(couponCode);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public boolean getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_isGiftVoucher();
      }
    }

    public void isCodApplicable(Cart cart, org.apache.thrift.async.AsyncMethodCallback<isCodApplicable_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      isCodApplicable_call method_call = new isCodApplicable_call(cart, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class isCodApplicable_call extends org.apache.thrift.async.TAsyncMethodCall {
      private Cart cart;
      public isCodApplicable_call(Cart cart, org.apache.thrift.async.AsyncMethodCallback<isCodApplicable_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.cart = cart;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("isCodApplicable", org.apache.thrift.protocol.TMessageType.CALL, 0));
        isCodApplicable_args args = new isCodApplicable_args();
        args.setCart(cart);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public boolean getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_isCodApplicable();
      }
    }

    public void getAllPromotions(org.apache.thrift.async.AsyncMethodCallback<getAllPromotions_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getAllPromotions_call method_call = new getAllPromotions_call(resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getAllPromotions_call extends org.apache.thrift.async.TAsyncMethodCall {
      public getAllPromotions_call(org.apache.thrift.async.AsyncMethodCallback<getAllPromotions_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getAllPromotions", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getAllPromotions_args args = new getAllPromotions_args();
        args.write(prot);
        prot.writeMessageEnd();
      }

      public List<Promotion> getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getAllPromotions();
      }
    }

    public void getPromotionById(long promotionId, org.apache.thrift.async.AsyncMethodCallback<getPromotionById_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getPromotionById_call method_call = new getPromotionById_call(promotionId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getPromotionById_call extends org.apache.thrift.async.TAsyncMethodCall {
      private long promotionId;
      public getPromotionById_call(long promotionId, org.apache.thrift.async.AsyncMethodCallback<getPromotionById_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.promotionId = promotionId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getPromotionById", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getPromotionById_args args = new getPromotionById_args();
        args.setPromotionId(promotionId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public Promotion getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getPromotionById();
      }
    }

    public void generateCouponsForPromotion(long promotionId, String couponCode, org.apache.thrift.async.AsyncMethodCallback<generateCouponsForPromotion_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      generateCouponsForPromotion_call method_call = new generateCouponsForPromotion_call(promotionId, couponCode, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class generateCouponsForPromotion_call extends org.apache.thrift.async.TAsyncMethodCall {
      private long promotionId;
      private String couponCode;
      public generateCouponsForPromotion_call(long promotionId, String couponCode, org.apache.thrift.async.AsyncMethodCallback<generateCouponsForPromotion_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.promotionId = promotionId;
        this.couponCode = couponCode;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("generateCouponsForPromotion", org.apache.thrift.protocol.TMessageType.CALL, 0));
        generateCouponsForPromotion_args args = new generateCouponsForPromotion_args();
        args.setPromotionId(promotionId);
        args.setCouponCode(couponCode);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_generateCouponsForPromotion();
      }
    }

    public void applyCoupon(String couponCode, long cartId, org.apache.thrift.async.AsyncMethodCallback<applyCoupon_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      applyCoupon_call method_call = new applyCoupon_call(couponCode, cartId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class applyCoupon_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String couponCode;
      private long cartId;
      public applyCoupon_call(String couponCode, long cartId, org.apache.thrift.async.AsyncMethodCallback<applyCoupon_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.couponCode = couponCode;
        this.cartId = cartId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("applyCoupon", org.apache.thrift.protocol.TMessageType.CALL, 0));
        applyCoupon_args args = new applyCoupon_args();
        args.setCouponCode(couponCode);
        args.setCartId(cartId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public Cart getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_applyCoupon();
      }
    }

    public void getEmiDiscount(long cartId, org.apache.thrift.async.AsyncMethodCallback<getEmiDiscount_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getEmiDiscount_call method_call = new getEmiDiscount_call(cartId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getEmiDiscount_call extends org.apache.thrift.async.TAsyncMethodCall {
      private long cartId;
      public getEmiDiscount_call(long cartId, org.apache.thrift.async.AsyncMethodCallback<getEmiDiscount_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.cartId = cartId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getEmiDiscount", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getEmiDiscount_args args = new getEmiDiscount_args();
        args.setCartId(cartId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public Map<Long,Double> getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getEmiDiscount();
      }
    }

    public void applyRechargeCoupon(String couponCode, long totalAmount, long userId, org.apache.thrift.async.AsyncMethodCallback<applyRechargeCoupon_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      applyRechargeCoupon_call method_call = new applyRechargeCoupon_call(couponCode, totalAmount, userId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class applyRechargeCoupon_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String couponCode;
      private long totalAmount;
      private long userId;
      public applyRechargeCoupon_call(String couponCode, long totalAmount, long userId, org.apache.thrift.async.AsyncMethodCallback<applyRechargeCoupon_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.couponCode = couponCode;
        this.totalAmount = totalAmount;
        this.userId = userId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("applyRechargeCoupon", org.apache.thrift.protocol.TMessageType.CALL, 0));
        applyRechargeCoupon_args args = new applyRechargeCoupon_args();
        args.setCouponCode(couponCode);
        args.setTotalAmount(totalAmount);
        args.setUserId(userId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public Map<Long,String> getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_applyRechargeCoupon();
      }
    }

    public void trackCouponUsage(String couponCode, long transactionId, long userId, long amount, boolean isDigital, org.apache.thrift.async.AsyncMethodCallback<trackCouponUsage_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      trackCouponUsage_call method_call = new trackCouponUsage_call(couponCode, transactionId, userId, amount, isDigital, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class trackCouponUsage_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String couponCode;
      private long transactionId;
      private long userId;
      private long amount;
      private boolean isDigital;
      public trackCouponUsage_call(String couponCode, long transactionId, long userId, long amount, boolean isDigital, org.apache.thrift.async.AsyncMethodCallback<trackCouponUsage_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.couponCode = couponCode;
        this.transactionId = transactionId;
        this.userId = userId;
        this.amount = amount;
        this.isDigital = isDigital;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("trackCouponUsage", org.apache.thrift.protocol.TMessageType.CALL, 0));
        trackCouponUsage_args args = new trackCouponUsage_args();
        args.setCouponCode(couponCode);
        args.setTransactionId(transactionId);
        args.setUserId(userId);
        args.setAmount(amount);
        args.setIsDigital(isDigital);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_trackCouponUsage();
      }
    }

    public void getCouponUsageCountByUser(String couponCode, long userId, org.apache.thrift.async.AsyncMethodCallback<getCouponUsageCountByUser_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getCouponUsageCountByUser_call method_call = new getCouponUsageCountByUser_call(couponCode, userId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getCouponUsageCountByUser_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String couponCode;
      private long userId;
      public getCouponUsageCountByUser_call(String couponCode, long userId, org.apache.thrift.async.AsyncMethodCallback<getCouponUsageCountByUser_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.couponCode = couponCode;
        this.userId = userId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getCouponUsageCountByUser", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getCouponUsageCountByUser_args args = new getCouponUsageCountByUser_args();
        args.setCouponCode(couponCode);
        args.setUserId(userId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public long getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getCouponUsageCountByUser();
      }
    }

    public void getActiveCodes(long promotionId, org.apache.thrift.async.AsyncMethodCallback<getActiveCodes_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getActiveCodes_call method_call = new getActiveCodes_call(promotionId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getActiveCodes_call extends org.apache.thrift.async.TAsyncMethodCall {
      private long promotionId;
      public getActiveCodes_call(long promotionId, org.apache.thrift.async.AsyncMethodCallback<getActiveCodes_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.promotionId = promotionId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getActiveCodes", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getActiveCodes_args args = new getActiveCodes_args();
        args.setPromotionId(promotionId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public List<Coupon> getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getActiveCodes();
      }
    }

    public void deleteCoupon(String couponCode, org.apache.thrift.async.AsyncMethodCallback<deleteCoupon_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      deleteCoupon_call method_call = new deleteCoupon_call(couponCode, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class deleteCoupon_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String couponCode;
      public deleteCoupon_call(String couponCode, org.apache.thrift.async.AsyncMethodCallback<deleteCoupon_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.couponCode = couponCode;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("deleteCoupon", org.apache.thrift.protocol.TMessageType.CALL, 0));
        deleteCoupon_args args = new deleteCoupon_args();
        args.setCouponCode(couponCode);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_deleteCoupon();
      }
    }

    public void getAllCouponsByPromotionId(long promotionId, org.apache.thrift.async.AsyncMethodCallback<getAllCouponsByPromotionId_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getAllCouponsByPromotionId_call method_call = new getAllCouponsByPromotionId_call(promotionId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getAllCouponsByPromotionId_call extends org.apache.thrift.async.TAsyncMethodCall {
      private long promotionId;
      public getAllCouponsByPromotionId_call(long promotionId, org.apache.thrift.async.AsyncMethodCallback<getAllCouponsByPromotionId_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.promotionId = promotionId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getAllCouponsByPromotionId", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getAllCouponsByPromotionId_args args = new getAllCouponsByPromotionId_args();
        args.setPromotionId(promotionId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public List<Coupon> getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getAllCouponsByPromotionId();
      }
    }

    public void getActiveCoupons(org.apache.thrift.async.AsyncMethodCallback<getActiveCoupons_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getActiveCoupons_call method_call = new getActiveCoupons_call(resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getActiveCoupons_call extends org.apache.thrift.async.TAsyncMethodCall {
      public getActiveCoupons_call(org.apache.thrift.async.AsyncMethodCallback<getActiveCoupons_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getActiveCoupons", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getActiveCoupons_args args = new getActiveCoupons_args();
        args.write(prot);
        prot.writeMessageEnd();
      }

      public List<Coupon> getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getActiveCoupons();
      }
    }

    public void createCoupon(long promotionId, long couponCategory, String couponCode, String arguments, boolean isCod, String prefix, org.apache.thrift.async.AsyncMethodCallback<createCoupon_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      createCoupon_call method_call = new createCoupon_call(promotionId, couponCategory, couponCode, arguments, isCod, prefix, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class createCoupon_call extends org.apache.thrift.async.TAsyncMethodCall {
      private long promotionId;
      private long couponCategory;
      private String couponCode;
      private String arguments;
      private boolean isCod;
      private String prefix;
      public createCoupon_call(long promotionId, long couponCategory, String couponCode, String arguments, boolean isCod, String prefix, org.apache.thrift.async.AsyncMethodCallback<createCoupon_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.promotionId = promotionId;
        this.couponCategory = couponCategory;
        this.couponCode = couponCode;
        this.arguments = arguments;
        this.isCod = isCod;
        this.prefix = prefix;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("createCoupon", org.apache.thrift.protocol.TMessageType.CALL, 0));
        createCoupon_args args = new createCoupon_args();
        args.setPromotionId(promotionId);
        args.setCouponCategory(couponCategory);
        args.setCouponCode(couponCode);
        args.setArguments(arguments);
        args.setIsCod(isCod);
        args.setPrefix(prefix);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public String getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_createCoupon();
      }
    }

    public void getSuccessfulPaymentCountForCoupon(String couponCode, org.apache.thrift.async.AsyncMethodCallback<getSuccessfulPaymentCountForCoupon_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getSuccessfulPaymentCountForCoupon_call method_call = new getSuccessfulPaymentCountForCoupon_call(couponCode, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getSuccessfulPaymentCountForCoupon_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String couponCode;
      public getSuccessfulPaymentCountForCoupon_call(String couponCode, org.apache.thrift.async.AsyncMethodCallback<getSuccessfulPaymentCountForCoupon_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.couponCode = couponCode;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getSuccessfulPaymentCountForCoupon", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getSuccessfulPaymentCountForCoupon_args args = new getSuccessfulPaymentCountForCoupon_args();
        args.setCouponCode(couponCode);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public long getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getSuccessfulPaymentCountForCoupon();
      }
    }

    public void getRuleDocString(String ruleName, org.apache.thrift.async.AsyncMethodCallback<getRuleDocString_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getRuleDocString_call method_call = new getRuleDocString_call(ruleName, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getRuleDocString_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String ruleName;
      public getRuleDocString_call(String ruleName, org.apache.thrift.async.AsyncMethodCallback<getRuleDocString_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.ruleName = ruleName;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getRuleDocString", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getRuleDocString_args args = new getRuleDocString_args();
        args.setRuleName(ruleName);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public String getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getRuleDocString();
      }
    }

    public void getItemDiscountMap(List<Long> itemIds, org.apache.thrift.async.AsyncMethodCallback<getItemDiscountMap_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getItemDiscountMap_call method_call = new getItemDiscountMap_call(itemIds, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getItemDiscountMap_call extends org.apache.thrift.async.TAsyncMethodCall {
      private List<Long> itemIds;
      public getItemDiscountMap_call(List<Long> itemIds, org.apache.thrift.async.AsyncMethodCallback<getItemDiscountMap_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.itemIds = itemIds;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getItemDiscountMap", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getItemDiscountMap_args args = new getItemDiscountMap_args();
        args.setItemIds(itemIds);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public List<ItemCouponDiscount> getResult() throws PromotionException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getItemDiscountMap();
      }
    }

    public void getDiscountsForEntity(long entityId, org.apache.thrift.async.AsyncMethodCallback<getDiscountsForEntity_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getDiscountsForEntity_call method_call = new getDiscountsForEntity_call(entityId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getDiscountsForEntity_call extends org.apache.thrift.async.TAsyncMethodCall {
      private long entityId;
      public getDiscountsForEntity_call(long entityId, org.apache.thrift.async.AsyncMethodCallback<getDiscountsForEntity_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.entityId = entityId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getDiscountsForEntity", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getDiscountsForEntity_args args = new getDiscountsForEntity_args();
        args.setEntityId(entityId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public Map<String,Double> getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_getDiscountsForEntity();
      }
    }

    public void addVoucher(Voucher voucher, org.apache.thrift.async.AsyncMethodCallback<addVoucher_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      addVoucher_call method_call = new addVoucher_call(voucher, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class addVoucher_call extends org.apache.thrift.async.TAsyncMethodCall {
      private Voucher voucher;
      public addVoucher_call(Voucher voucher, org.apache.thrift.async.AsyncMethodCallback<addVoucher_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.voucher = voucher;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("addVoucher", org.apache.thrift.protocol.TMessageType.CALL, 0));
        addVoucher_args args = new addVoucher_args();
        args.setVoucher(voucher);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_addVoucher();
      }
    }

    public void assignVoucher(long userId, String userEmail, VoucherType voucherType, long amount, org.apache.thrift.async.AsyncMethodCallback<assignVoucher_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      assignVoucher_call method_call = new assignVoucher_call(userId, userEmail, voucherType, amount, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class assignVoucher_call extends org.apache.thrift.async.TAsyncMethodCall {
      private long userId;
      private String userEmail;
      private VoucherType voucherType;
      private long amount;
      public assignVoucher_call(long userId, String userEmail, VoucherType voucherType, long amount, org.apache.thrift.async.AsyncMethodCallback<assignVoucher_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.userId = userId;
        this.userEmail = userEmail;
        this.voucherType = voucherType;
        this.amount = amount;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("assignVoucher", org.apache.thrift.protocol.TMessageType.CALL, 0));
        assignVoucher_args args = new assignVoucher_args();
        args.setUserId(userId);
        args.setUserEmail(userEmail);
        args.setVoucherType(voucherType);
        args.setAmount(amount);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public Voucher getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_assignVoucher();
      }
    }

    public void markVoucherAsRedeemed(String voucherCode, long redeemedOn, org.apache.thrift.async.AsyncMethodCallback<markVoucherAsRedeemed_call> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      markVoucherAsRedeemed_call method_call = new markVoucherAsRedeemed_call(voucherCode, redeemedOn, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class markVoucherAsRedeemed_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String voucherCode;
      private long redeemedOn;
      public markVoucherAsRedeemed_call(String voucherCode, long redeemedOn, org.apache.thrift.async.AsyncMethodCallback<markVoucherAsRedeemed_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.voucherCode = voucherCode;
        this.redeemedOn = redeemedOn;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("markVoucherAsRedeemed", org.apache.thrift.protocol.TMessageType.CALL, 0));
        markVoucherAsRedeemed_args args = new markVoucherAsRedeemed_args();
        args.setVoucherCode(voucherCode);
        args.setRedeemedOn(redeemedOn);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public boolean getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_markVoucherAsRedeemed();
      }
    }

  }

  public static class Processor<I extends Iface> extends in.shop2020.generic.GenericService.Processor implements org.apache.thrift.TProcessor {
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
    public Processor(I iface) {
      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
    }

    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
      processMap.put("createPromotion", new createPromotion());
      processMap.put("removeAllCouponsByPromotionId", new removeAllCouponsByPromotionId());
      processMap.put("getCoupon", new getCoupon());
      processMap.put("isGiftVoucher", new isGiftVoucher());
      processMap.put("isCodApplicable", new isCodApplicable());
      processMap.put("getAllPromotions", new getAllPromotions());
      processMap.put("getPromotionById", new getPromotionById());
      processMap.put("generateCouponsForPromotion", new generateCouponsForPromotion());
      processMap.put("applyCoupon", new applyCoupon());
      processMap.put("getEmiDiscount", new getEmiDiscount());
      processMap.put("applyRechargeCoupon", new applyRechargeCoupon());
      processMap.put("trackCouponUsage", new trackCouponUsage());
      processMap.put("getCouponUsageCountByUser", new getCouponUsageCountByUser());
      processMap.put("getActiveCodes", new getActiveCodes());
      processMap.put("deleteCoupon", new deleteCoupon());
      processMap.put("getAllCouponsByPromotionId", new getAllCouponsByPromotionId());
      processMap.put("getActiveCoupons", new getActiveCoupons());
      processMap.put("createCoupon", new createCoupon());
      processMap.put("getSuccessfulPaymentCountForCoupon", new getSuccessfulPaymentCountForCoupon());
      processMap.put("getRuleDocString", new getRuleDocString());
      processMap.put("getItemDiscountMap", new getItemDiscountMap());
      processMap.put("getDiscountsForEntity", new getDiscountsForEntity());
      processMap.put("addVoucher", new addVoucher());
      processMap.put("assignVoucher", new assignVoucher());
      processMap.put("markVoucherAsRedeemed", new markVoucherAsRedeemed());
      return processMap;
    }

    private static class createPromotion<I extends Iface> extends org.apache.thrift.ProcessFunction<I, createPromotion_args> {
      public createPromotion() {
        super("createPromotion");
      }

      protected createPromotion_args getEmptyArgsInstance() {
        return new createPromotion_args();
      }

      protected createPromotion_result getResult(I iface, createPromotion_args args) throws org.apache.thrift.TException {
        createPromotion_result result = new createPromotion_result();
        try {
          iface.createPromotion(args.name, args.ruleExecutionSrc, args.startOn, args.endOn);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class removeAllCouponsByPromotionId<I extends Iface> extends org.apache.thrift.ProcessFunction<I, removeAllCouponsByPromotionId_args> {
      public removeAllCouponsByPromotionId() {
        super("removeAllCouponsByPromotionId");
      }

      protected removeAllCouponsByPromotionId_args getEmptyArgsInstance() {
        return new removeAllCouponsByPromotionId_args();
      }

      protected removeAllCouponsByPromotionId_result getResult(I iface, removeAllCouponsByPromotionId_args args) throws org.apache.thrift.TException {
        removeAllCouponsByPromotionId_result result = new removeAllCouponsByPromotionId_result();
        try {
          result.success = iface.removeAllCouponsByPromotionId(args.promotionId);
          result.setSuccessIsSet(true);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class getCoupon<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getCoupon_args> {
      public getCoupon() {
        super("getCoupon");
      }

      protected getCoupon_args getEmptyArgsInstance() {
        return new getCoupon_args();
      }

      protected getCoupon_result getResult(I iface, getCoupon_args args) throws org.apache.thrift.TException {
        getCoupon_result result = new getCoupon_result();
        try {
          result.success = iface.getCoupon(args.couponCode);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class isGiftVoucher<I extends Iface> extends org.apache.thrift.ProcessFunction<I, isGiftVoucher_args> {
      public isGiftVoucher() {
        super("isGiftVoucher");
      }

      protected isGiftVoucher_args getEmptyArgsInstance() {
        return new isGiftVoucher_args();
      }

      protected isGiftVoucher_result getResult(I iface, isGiftVoucher_args args) throws org.apache.thrift.TException {
        isGiftVoucher_result result = new isGiftVoucher_result();
        try {
          result.success = iface.isGiftVoucher(args.couponCode);
          result.setSuccessIsSet(true);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class isCodApplicable<I extends Iface> extends org.apache.thrift.ProcessFunction<I, isCodApplicable_args> {
      public isCodApplicable() {
        super("isCodApplicable");
      }

      protected isCodApplicable_args getEmptyArgsInstance() {
        return new isCodApplicable_args();
      }

      protected isCodApplicable_result getResult(I iface, isCodApplicable_args args) throws org.apache.thrift.TException {
        isCodApplicable_result result = new isCodApplicable_result();
        try {
          result.success = iface.isCodApplicable(args.cart);
          result.setSuccessIsSet(true);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class getAllPromotions<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getAllPromotions_args> {
      public getAllPromotions() {
        super("getAllPromotions");
      }

      protected getAllPromotions_args getEmptyArgsInstance() {
        return new getAllPromotions_args();
      }

      protected getAllPromotions_result getResult(I iface, getAllPromotions_args args) throws org.apache.thrift.TException {
        getAllPromotions_result result = new getAllPromotions_result();
        try {
          result.success = iface.getAllPromotions();
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class getPromotionById<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getPromotionById_args> {
      public getPromotionById() {
        super("getPromotionById");
      }

      protected getPromotionById_args getEmptyArgsInstance() {
        return new getPromotionById_args();
      }

      protected getPromotionById_result getResult(I iface, getPromotionById_args args) throws org.apache.thrift.TException {
        getPromotionById_result result = new getPromotionById_result();
        try {
          result.success = iface.getPromotionById(args.promotionId);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class generateCouponsForPromotion<I extends Iface> extends org.apache.thrift.ProcessFunction<I, generateCouponsForPromotion_args> {
      public generateCouponsForPromotion() {
        super("generateCouponsForPromotion");
      }

      protected generateCouponsForPromotion_args getEmptyArgsInstance() {
        return new generateCouponsForPromotion_args();
      }

      protected generateCouponsForPromotion_result getResult(I iface, generateCouponsForPromotion_args args) throws org.apache.thrift.TException {
        generateCouponsForPromotion_result result = new generateCouponsForPromotion_result();
        try {
          iface.generateCouponsForPromotion(args.promotionId, args.couponCode);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class applyCoupon<I extends Iface> extends org.apache.thrift.ProcessFunction<I, applyCoupon_args> {
      public applyCoupon() {
        super("applyCoupon");
      }

      protected applyCoupon_args getEmptyArgsInstance() {
        return new applyCoupon_args();
      }

      protected applyCoupon_result getResult(I iface, applyCoupon_args args) throws org.apache.thrift.TException {
        applyCoupon_result result = new applyCoupon_result();
        try {
          result.success = iface.applyCoupon(args.couponCode, args.cartId);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class getEmiDiscount<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getEmiDiscount_args> {
      public getEmiDiscount() {
        super("getEmiDiscount");
      }

      protected getEmiDiscount_args getEmptyArgsInstance() {
        return new getEmiDiscount_args();
      }

      protected getEmiDiscount_result getResult(I iface, getEmiDiscount_args args) throws org.apache.thrift.TException {
        getEmiDiscount_result result = new getEmiDiscount_result();
        try {
          result.success = iface.getEmiDiscount(args.cartId);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class applyRechargeCoupon<I extends Iface> extends org.apache.thrift.ProcessFunction<I, applyRechargeCoupon_args> {
      public applyRechargeCoupon() {
        super("applyRechargeCoupon");
      }

      protected applyRechargeCoupon_args getEmptyArgsInstance() {
        return new applyRechargeCoupon_args();
      }

      protected applyRechargeCoupon_result getResult(I iface, applyRechargeCoupon_args args) throws org.apache.thrift.TException {
        applyRechargeCoupon_result result = new applyRechargeCoupon_result();
        try {
          result.success = iface.applyRechargeCoupon(args.couponCode, args.totalAmount, args.userId);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class trackCouponUsage<I extends Iface> extends org.apache.thrift.ProcessFunction<I, trackCouponUsage_args> {
      public trackCouponUsage() {
        super("trackCouponUsage");
      }

      protected trackCouponUsage_args getEmptyArgsInstance() {
        return new trackCouponUsage_args();
      }

      protected trackCouponUsage_result getResult(I iface, trackCouponUsage_args args) throws org.apache.thrift.TException {
        trackCouponUsage_result result = new trackCouponUsage_result();
        try {
          iface.trackCouponUsage(args.couponCode, args.transactionId, args.userId, args.amount, args.isDigital);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class getCouponUsageCountByUser<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getCouponUsageCountByUser_args> {
      public getCouponUsageCountByUser() {
        super("getCouponUsageCountByUser");
      }

      protected getCouponUsageCountByUser_args getEmptyArgsInstance() {
        return new getCouponUsageCountByUser_args();
      }

      protected getCouponUsageCountByUser_result getResult(I iface, getCouponUsageCountByUser_args args) throws org.apache.thrift.TException {
        getCouponUsageCountByUser_result result = new getCouponUsageCountByUser_result();
        try {
          result.success = iface.getCouponUsageCountByUser(args.couponCode, args.userId);
          result.setSuccessIsSet(true);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class getActiveCodes<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getActiveCodes_args> {
      public getActiveCodes() {
        super("getActiveCodes");
      }

      protected getActiveCodes_args getEmptyArgsInstance() {
        return new getActiveCodes_args();
      }

      protected getActiveCodes_result getResult(I iface, getActiveCodes_args args) throws org.apache.thrift.TException {
        getActiveCodes_result result = new getActiveCodes_result();
        try {
          result.success = iface.getActiveCodes(args.promotionId);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class deleteCoupon<I extends Iface> extends org.apache.thrift.ProcessFunction<I, deleteCoupon_args> {
      public deleteCoupon() {
        super("deleteCoupon");
      }

      protected deleteCoupon_args getEmptyArgsInstance() {
        return new deleteCoupon_args();
      }

      protected deleteCoupon_result getResult(I iface, deleteCoupon_args args) throws org.apache.thrift.TException {
        deleteCoupon_result result = new deleteCoupon_result();
        try {
          iface.deleteCoupon(args.couponCode);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class getAllCouponsByPromotionId<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getAllCouponsByPromotionId_args> {
      public getAllCouponsByPromotionId() {
        super("getAllCouponsByPromotionId");
      }

      protected getAllCouponsByPromotionId_args getEmptyArgsInstance() {
        return new getAllCouponsByPromotionId_args();
      }

      protected getAllCouponsByPromotionId_result getResult(I iface, getAllCouponsByPromotionId_args args) throws org.apache.thrift.TException {
        getAllCouponsByPromotionId_result result = new getAllCouponsByPromotionId_result();
        try {
          result.success = iface.getAllCouponsByPromotionId(args.promotionId);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class getActiveCoupons<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getActiveCoupons_args> {
      public getActiveCoupons() {
        super("getActiveCoupons");
      }

      protected getActiveCoupons_args getEmptyArgsInstance() {
        return new getActiveCoupons_args();
      }

      protected getActiveCoupons_result getResult(I iface, getActiveCoupons_args args) throws org.apache.thrift.TException {
        getActiveCoupons_result result = new getActiveCoupons_result();
        try {
          result.success = iface.getActiveCoupons();
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class createCoupon<I extends Iface> extends org.apache.thrift.ProcessFunction<I, createCoupon_args> {
      public createCoupon() {
        super("createCoupon");
      }

      protected createCoupon_args getEmptyArgsInstance() {
        return new createCoupon_args();
      }

      protected createCoupon_result getResult(I iface, createCoupon_args args) throws org.apache.thrift.TException {
        createCoupon_result result = new createCoupon_result();
        try {
          result.success = iface.createCoupon(args.promotionId, args.couponCategory, args.couponCode, args.arguments, args.isCod, args.prefix);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class getSuccessfulPaymentCountForCoupon<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getSuccessfulPaymentCountForCoupon_args> {
      public getSuccessfulPaymentCountForCoupon() {
        super("getSuccessfulPaymentCountForCoupon");
      }

      protected getSuccessfulPaymentCountForCoupon_args getEmptyArgsInstance() {
        return new getSuccessfulPaymentCountForCoupon_args();
      }

      protected getSuccessfulPaymentCountForCoupon_result getResult(I iface, getSuccessfulPaymentCountForCoupon_args args) throws org.apache.thrift.TException {
        getSuccessfulPaymentCountForCoupon_result result = new getSuccessfulPaymentCountForCoupon_result();
        try {
          result.success = iface.getSuccessfulPaymentCountForCoupon(args.couponCode);
          result.setSuccessIsSet(true);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class getRuleDocString<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getRuleDocString_args> {
      public getRuleDocString() {
        super("getRuleDocString");
      }

      protected getRuleDocString_args getEmptyArgsInstance() {
        return new getRuleDocString_args();
      }

      protected getRuleDocString_result getResult(I iface, getRuleDocString_args args) throws org.apache.thrift.TException {
        getRuleDocString_result result = new getRuleDocString_result();
        result.success = iface.getRuleDocString(args.ruleName);
        return result;
      }
    }

    private static class getItemDiscountMap<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getItemDiscountMap_args> {
      public getItemDiscountMap() {
        super("getItemDiscountMap");
      }

      protected getItemDiscountMap_args getEmptyArgsInstance() {
        return new getItemDiscountMap_args();
      }

      protected getItemDiscountMap_result getResult(I iface, getItemDiscountMap_args args) throws org.apache.thrift.TException {
        getItemDiscountMap_result result = new getItemDiscountMap_result();
        try {
          result.success = iface.getItemDiscountMap(args.itemIds);
        } catch (PromotionException pex) {
          result.pex = pex;
        }
        return result;
      }
    }

    private static class getDiscountsForEntity<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getDiscountsForEntity_args> {
      public getDiscountsForEntity() {
        super("getDiscountsForEntity");
      }

      protected getDiscountsForEntity_args getEmptyArgsInstance() {
        return new getDiscountsForEntity_args();
      }

      protected getDiscountsForEntity_result getResult(I iface, getDiscountsForEntity_args args) throws org.apache.thrift.TException {
        getDiscountsForEntity_result result = new getDiscountsForEntity_result();
        result.success = iface.getDiscountsForEntity(args.entityId);
        return result;
      }
    }

    private static class addVoucher<I extends Iface> extends org.apache.thrift.ProcessFunction<I, addVoucher_args> {
      public addVoucher() {
        super("addVoucher");
      }

      protected addVoucher_args getEmptyArgsInstance() {
        return new addVoucher_args();
      }

      protected addVoucher_result getResult(I iface, addVoucher_args args) throws org.apache.thrift.TException {
        addVoucher_result result = new addVoucher_result();
        iface.addVoucher(args.voucher);
        return result;
      }
    }

    private static class assignVoucher<I extends Iface> extends org.apache.thrift.ProcessFunction<I, assignVoucher_args> {
      public assignVoucher() {
        super("assignVoucher");
      }

      protected assignVoucher_args getEmptyArgsInstance() {
        return new assignVoucher_args();
      }

      protected assignVoucher_result getResult(I iface, assignVoucher_args args) throws org.apache.thrift.TException {
        assignVoucher_result result = new assignVoucher_result();
        result.success = iface.assignVoucher(args.userId, args.userEmail, args.voucherType, args.amount);
        return result;
      }
    }

    private static class markVoucherAsRedeemed<I extends Iface> extends org.apache.thrift.ProcessFunction<I, markVoucherAsRedeemed_args> {
      public markVoucherAsRedeemed() {
        super("markVoucherAsRedeemed");
      }

      protected markVoucherAsRedeemed_args getEmptyArgsInstance() {
        return new markVoucherAsRedeemed_args();
      }

      protected markVoucherAsRedeemed_result getResult(I iface, markVoucherAsRedeemed_args args) throws org.apache.thrift.TException {
        markVoucherAsRedeemed_result result = new markVoucherAsRedeemed_result();
        result.success = iface.markVoucherAsRedeemed(args.voucherCode, args.redeemedOn);
        result.setSuccessIsSet(true);
        return result;
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1);
    private static final org.apache.thrift.protocol.TField RULE_EXECUTION_SRC_FIELD_DESC = new org.apache.thrift.protocol.TField("ruleExecutionSrc", org.apache.thrift.protocol.TType.STRING, (short)2);
    private static final org.apache.thrift.protocol.TField START_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("startOn", org.apache.thrift.protocol.TType.I64, (short)3);
    private static final org.apache.thrift.protocol.TField END_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("endOn", org.apache.thrift.protocol.TType.I64, (short)4);

    private String name; // required
    private String ruleExecutionSrc; // required
    private long startOn; // required
    private long endOn; // 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 {
      NAME((short)1, "name"),
      RULE_EXECUTION_SRC((short)2, "ruleExecutionSrc"),
      START_ON((short)3, "startOn"),
      END_ON((short)4, "endOn");

      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: // NAME
            return NAME;
          case 2: // RULE_EXECUTION_SRC
            return RULE_EXECUTION_SRC;
          case 3: // START_ON
            return START_ON;
          case 4: // END_ON
            return END_ON;
          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 __STARTON_ISSET_ID = 0;
    private static final int __ENDON_ISSET_ID = 1;
    private BitSet __isset_bit_vector = new BitSet(2);

    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.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.RULE_EXECUTION_SRC, new org.apache.thrift.meta_data.FieldMetaData("ruleExecutionSrc", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.START_ON, new org.apache.thrift.meta_data.FieldMetaData("startOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.END_ON, new org.apache.thrift.meta_data.FieldMetaData("endOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(createPromotion_args.class, metaDataMap);
    }

    public createPromotion_args() {
    }

    public createPromotion_args(
      String name,
      String ruleExecutionSrc,
      long startOn,
      long endOn)
    {
      this();
      this.name = name;
      this.ruleExecutionSrc = ruleExecutionSrc;
      this.startOn = startOn;
      setStartOnIsSet(true);
      this.endOn = endOn;
      setEndOnIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public createPromotion_args(createPromotion_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      if (other.isSetName()) {
        this.name = other.name;
      }
      if (other.isSetRuleExecutionSrc()) {
        this.ruleExecutionSrc = other.ruleExecutionSrc;
      }
      this.startOn = other.startOn;
      this.endOn = other.endOn;
    }

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

    @Override
    public void clear() {
      this.name = null;
      this.ruleExecutionSrc = null;
      setStartOnIsSet(false);
      this.startOn = 0;
      setEndOnIsSet(false);
      this.endOn = 0;
    }

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

    public void setName(String name) {
      this.name = name;
    }

    public void unsetName() {
      this.name = null;
    }

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

    public void setNameIsSet(boolean value) {
      if (!value) {
        this.name = null;
      }
    }

    public String getRuleExecutionSrc() {
      return this.ruleExecutionSrc;
    }

    public void setRuleExecutionSrc(String ruleExecutionSrc) {
      this.ruleExecutionSrc = ruleExecutionSrc;
    }

    public void unsetRuleExecutionSrc() {
      this.ruleExecutionSrc = null;
    }

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

    public void setRuleExecutionSrcIsSet(boolean value) {
      if (!value) {
        this.ruleExecutionSrc = null;
      }
    }

    public long getStartOn() {
      return this.startOn;
    }

    public void setStartOn(long startOn) {
      this.startOn = startOn;
      setStartOnIsSet(true);
    }

    public void unsetStartOn() {
      __isset_bit_vector.clear(__STARTON_ISSET_ID);
    }

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

    public void setStartOnIsSet(boolean value) {
      __isset_bit_vector.set(__STARTON_ISSET_ID, value);
    }

    public long getEndOn() {
      return this.endOn;
    }

    public void setEndOn(long endOn) {
      this.endOn = endOn;
      setEndOnIsSet(true);
    }

    public void unsetEndOn() {
      __isset_bit_vector.clear(__ENDON_ISSET_ID);
    }

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

    public void setEndOnIsSet(boolean value) {
      __isset_bit_vector.set(__ENDON_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case NAME:
        if (value == null) {
          unsetName();
        } else {
          setName((String)value);
        }
        break;

      case RULE_EXECUTION_SRC:
        if (value == null) {
          unsetRuleExecutionSrc();
        } else {
          setRuleExecutionSrc((String)value);
        }
        break;

      case START_ON:
        if (value == null) {
          unsetStartOn();
        } else {
          setStartOn((Long)value);
        }
        break;

      case END_ON:
        if (value == null) {
          unsetEndOn();
        } else {
          setEndOn((Long)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case NAME:
        return getName();

      case RULE_EXECUTION_SRC:
        return getRuleExecutionSrc();

      case START_ON:
        return Long.valueOf(getStartOn());

      case END_ON:
        return Long.valueOf(getEndOn());

      }
      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 NAME:
        return isSetName();
      case RULE_EXECUTION_SRC:
        return isSetRuleExecutionSrc();
      case START_ON:
        return isSetStartOn();
      case END_ON:
        return isSetEndOn();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_name = true && this.isSetName();
      boolean that_present_name = true && that.isSetName();
      if (this_present_name || that_present_name) {
        if (!(this_present_name && that_present_name))
          return false;
        if (!this.name.equals(that.name))
          return false;
      }

      boolean this_present_ruleExecutionSrc = true && this.isSetRuleExecutionSrc();
      boolean that_present_ruleExecutionSrc = true && that.isSetRuleExecutionSrc();
      if (this_present_ruleExecutionSrc || that_present_ruleExecutionSrc) {
        if (!(this_present_ruleExecutionSrc && that_present_ruleExecutionSrc))
          return false;
        if (!this.ruleExecutionSrc.equals(that.ruleExecutionSrc))
          return false;
      }

      boolean this_present_startOn = true;
      boolean that_present_startOn = true;
      if (this_present_startOn || that_present_startOn) {
        if (!(this_present_startOn && that_present_startOn))
          return false;
        if (this.startOn != that.startOn)
          return false;
      }

      boolean this_present_endOn = true;
      boolean that_present_endOn = true;
      if (this_present_endOn || that_present_endOn) {
        if (!(this_present_endOn && that_present_endOn))
          return false;
        if (this.endOn != that.endOn)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetName()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetRuleExecutionSrc()).compareTo(typedOther.isSetRuleExecutionSrc());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetRuleExecutionSrc()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ruleExecutionSrc, typedOther.ruleExecutionSrc);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetStartOn()).compareTo(typedOther.isSetStartOn());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetStartOn()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startOn, typedOther.startOn);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetEndOn()).compareTo(typedOther.isSetEndOn());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEndOn()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.endOn, typedOther.endOn);
        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: // NAME
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.name = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 2: // RULE_EXECUTION_SRC
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.ruleExecutionSrc = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 3: // START_ON
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.startOn = iprot.readI64();
              setStartOnIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 4: // END_ON
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.endOn = iprot.readI64();
              setEndOnIsSet(true);
            } 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.name != null) {
        oprot.writeFieldBegin(NAME_FIELD_DESC);
        oprot.writeString(this.name);
        oprot.writeFieldEnd();
      }
      if (this.ruleExecutionSrc != null) {
        oprot.writeFieldBegin(RULE_EXECUTION_SRC_FIELD_DESC);
        oprot.writeString(this.ruleExecutionSrc);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(START_ON_FIELD_DESC);
      oprot.writeI64(this.startOn);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(END_ON_FIELD_DESC);
      oprot.writeI64(this.endOn);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("name:");
      if (this.name == null) {
        sb.append("null");
      } else {
        sb.append(this.name);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("ruleExecutionSrc:");
      if (this.ruleExecutionSrc == null) {
        sb.append("null");
      } else {
        sb.append(this.ruleExecutionSrc);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("startOn:");
      sb.append(this.startOn);
      first = false;
      if (!first) sb.append(", ");
      sb.append("endOn:");
      sb.append(this.endOn);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private PromotionException pex; // 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 {
      PEX((short)1, "pex");

      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: // PEX
            return PEX;
          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

    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.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(createPromotion_result.class, metaDataMap);
    }

    public createPromotion_result() {
    }

    public createPromotion_result(
      PromotionException pex)
    {
      this();
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public createPromotion_result(createPromotion_result other) {
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.pex = null;
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PEX:
        return getPex();

      }
      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 PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PROMOTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionId", org.apache.thrift.protocol.TType.I64, (short)1);

    private long promotionId; // 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 {
      PROMOTION_ID((short)1, "promotionId");

      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: // PROMOTION_ID
            return PROMOTION_ID;
          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 __PROMOTIONID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.PROMOTION_ID, new org.apache.thrift.meta_data.FieldMetaData("promotionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(removeAllCouponsByPromotionId_args.class, metaDataMap);
    }

    public removeAllCouponsByPromotionId_args() {
    }

    public removeAllCouponsByPromotionId_args(
      long promotionId)
    {
      this();
      this.promotionId = promotionId;
      setPromotionIdIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public removeAllCouponsByPromotionId_args(removeAllCouponsByPromotionId_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.promotionId = other.promotionId;
    }

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

    @Override
    public void clear() {
      setPromotionIdIsSet(false);
      this.promotionId = 0;
    }

    public long getPromotionId() {
      return this.promotionId;
    }

    public void setPromotionId(long promotionId) {
      this.promotionId = promotionId;
      setPromotionIdIsSet(true);
    }

    public void unsetPromotionId() {
      __isset_bit_vector.clear(__PROMOTIONID_ISSET_ID);
    }

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

    public void setPromotionIdIsSet(boolean value) {
      __isset_bit_vector.set(__PROMOTIONID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROMOTION_ID:
        if (value == null) {
          unsetPromotionId();
        } else {
          setPromotionId((Long)value);
        }
        break;

      }
    }

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

      }
      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 PROMOTION_ID:
        return isSetPromotionId();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_promotionId = true;
      boolean that_present_promotionId = true;
      if (this_present_promotionId || that_present_promotionId) {
        if (!(this_present_promotionId && that_present_promotionId))
          return false;
        if (this.promotionId != that.promotionId)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPromotionId()).compareTo(typedOther.isSetPromotionId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPromotionId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionId, typedOther.promotionId);
        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: // PROMOTION_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.promotionId = iprot.readI64();
              setPromotionIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(PROMOTION_ID_FIELD_DESC);
      oprot.writeI64(this.promotionId);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("promotionId:");
      sb.append(this.promotionId);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I64, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private long success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(removeAllCouponsByPromotionId_result.class, metaDataMap);
    }

    public removeAllCouponsByPromotionId_result() {
    }

    public removeAllCouponsByPromotionId_result(
      long success,
      PromotionException pex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public removeAllCouponsByPromotionId_result(removeAllCouponsByPromotionId_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      setSuccessIsSet(false);
      this.success = 0;
      this.pex = null;
    }

    public long getSuccess() {
      return this.success;
    }

    public void setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Long)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

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

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.success = iprot.readI64();
              setSuccessIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeI64(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)1);

    private String couponCode; // 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 {
      COUPON_CODE((short)1, "couponCode");

      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: // COUPON_CODE
            return COUPON_CODE;
          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

    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.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getCoupon_args.class, metaDataMap);
    }

    public getCoupon_args() {
    }

    public getCoupon_args(
      String couponCode)
    {
      this();
      this.couponCode = couponCode;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getCoupon_args(getCoupon_args other) {
      if (other.isSetCouponCode()) {
        this.couponCode = other.couponCode;
      }
    }

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

    @Override
    public void clear() {
      this.couponCode = null;
    }

    public String getCouponCode() {
      return this.couponCode;
    }

    public void setCouponCode(String couponCode) {
      this.couponCode = couponCode;
    }

    public void unsetCouponCode() {
      this.couponCode = null;
    }

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

    public void setCouponCodeIsSet(boolean value) {
      if (!value) {
        this.couponCode = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case COUPON_CODE:
        if (value == null) {
          unsetCouponCode();
        } else {
          setCouponCode((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case COUPON_CODE:
        return getCouponCode();

      }
      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 COUPON_CODE:
        return isSetCouponCode();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_couponCode = true && this.isSetCouponCode();
      boolean that_present_couponCode = true && that.isSetCouponCode();
      if (this_present_couponCode || that_present_couponCode) {
        if (!(this_present_couponCode && that_present_couponCode))
          return false;
        if (!this.couponCode.equals(that.couponCode))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCouponCode()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
        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: // COUPON_CODE
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.couponCode = iprot.readString();
            } 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.couponCode != null) {
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
        oprot.writeString(this.couponCode);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("couponCode:");
      if (this.couponCode == null) {
        sb.append("null");
      } else {
        sb.append(this.couponCode);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private Coupon success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Coupon.class)));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getCoupon_result.class, metaDataMap);
    }

    public getCoupon_result() {
    }

    public getCoupon_result(
      Coupon success,
      PromotionException pex)
    {
      this();
      this.success = success;
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getCoupon_result(getCoupon_result other) {
      if (other.isSetSuccess()) {
        this.success = new Coupon(other.success);
      }
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.pex = null;
    }

    public Coupon getSuccess() {
      return this.success;
    }

    public void setSuccess(Coupon success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Coupon)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.success = new Coupon();
              this.success.read(iprot);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        this.success.write(oprot);
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)1);

    private String couponCode; // 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 {
      COUPON_CODE((short)1, "couponCode");

      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: // COUPON_CODE
            return COUPON_CODE;
          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

    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.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isGiftVoucher_args.class, metaDataMap);
    }

    public isGiftVoucher_args() {
    }

    public isGiftVoucher_args(
      String couponCode)
    {
      this();
      this.couponCode = couponCode;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public isGiftVoucher_args(isGiftVoucher_args other) {
      if (other.isSetCouponCode()) {
        this.couponCode = other.couponCode;
      }
    }

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

    @Override
    public void clear() {
      this.couponCode = null;
    }

    public String getCouponCode() {
      return this.couponCode;
    }

    public void setCouponCode(String couponCode) {
      this.couponCode = couponCode;
    }

    public void unsetCouponCode() {
      this.couponCode = null;
    }

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

    public void setCouponCodeIsSet(boolean value) {
      if (!value) {
        this.couponCode = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case COUPON_CODE:
        if (value == null) {
          unsetCouponCode();
        } else {
          setCouponCode((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case COUPON_CODE:
        return getCouponCode();

      }
      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 COUPON_CODE:
        return isSetCouponCode();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_couponCode = true && this.isSetCouponCode();
      boolean that_present_couponCode = true && that.isSetCouponCode();
      if (this_present_couponCode || that_present_couponCode) {
        if (!(this_present_couponCode && that_present_couponCode))
          return false;
        if (!this.couponCode.equals(that.couponCode))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCouponCode()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
        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: // COUPON_CODE
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.couponCode = iprot.readString();
            } 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.couponCode != null) {
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
        oprot.writeString(this.couponCode);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("couponCode:");
      if (this.couponCode == null) {
        sb.append("null");
      } else {
        sb.append(this.couponCode);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private boolean success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isGiftVoucher_result.class, metaDataMap);
    }

    public isGiftVoucher_result() {
    }

    public isGiftVoucher_result(
      boolean success,
      PromotionException pex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public isGiftVoucher_result(isGiftVoucher_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      setSuccessIsSet(false);
      this.success = false;
      this.pex = null;
    }

    public boolean isSuccess() {
      return this.success;
    }

    public void setSuccess(boolean success) {
      this.success = success;
      setSuccessIsSet(true);
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Boolean)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return Boolean.valueOf(isSuccess());

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.BOOL) {
              this.success = iprot.readBool();
              setSuccessIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeBool(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField CART_FIELD_DESC = new org.apache.thrift.protocol.TField("cart", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private Cart cart; // 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 {
      CART((short)1, "cart");

      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: // CART
            return CART;
          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

    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.CART, new org.apache.thrift.meta_data.FieldMetaData("cart", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Cart.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isCodApplicable_args.class, metaDataMap);
    }

    public isCodApplicable_args() {
    }

    public isCodApplicable_args(
      Cart cart)
    {
      this();
      this.cart = cart;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public isCodApplicable_args(isCodApplicable_args other) {
      if (other.isSetCart()) {
        this.cart = new Cart(other.cart);
      }
    }

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

    @Override
    public void clear() {
      this.cart = null;
    }

    public Cart getCart() {
      return this.cart;
    }

    public void setCart(Cart cart) {
      this.cart = cart;
    }

    public void unsetCart() {
      this.cart = null;
    }

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

    public void setCartIsSet(boolean value) {
      if (!value) {
        this.cart = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case CART:
        if (value == null) {
          unsetCart();
        } else {
          setCart((Cart)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case CART:
        return getCart();

      }
      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 CART:
        return isSetCart();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_cart = true && this.isSetCart();
      boolean that_present_cart = true && that.isSetCart();
      if (this_present_cart || that_present_cart) {
        if (!(this_present_cart && that_present_cart))
          return false;
        if (!this.cart.equals(that.cart))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCart()).compareTo(typedOther.isSetCart());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCart()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cart, typedOther.cart);
        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: // CART
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.cart = new Cart();
              this.cart.read(iprot);
            } 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.cart != null) {
        oprot.writeFieldBegin(CART_FIELD_DESC);
        this.cart.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("cart:");
      if (this.cart == null) {
        sb.append("null");
      } else {
        sb.append(this.cart);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private boolean success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isCodApplicable_result.class, metaDataMap);
    }

    public isCodApplicable_result() {
    }

    public isCodApplicable_result(
      boolean success,
      PromotionException pex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public isCodApplicable_result(isCodApplicable_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      setSuccessIsSet(false);
      this.success = false;
      this.pex = null;
    }

    public boolean isSuccess() {
      return this.success;
    }

    public void setSuccess(boolean success) {
      this.success = success;
      setSuccessIsSet(true);
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Boolean)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return Boolean.valueOf(isSuccess());

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.BOOL) {
              this.success = iprot.readBool();
              setSuccessIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeBool(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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



    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
;

      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) {
          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;
      }
    }
    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);
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllPromotions_args.class, metaDataMap);
    }

    public getAllPromotions_args() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllPromotions_args(getAllPromotions_args other) {
    }

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

    @Override
    public void clear() {
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      }
      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) {
      }
      throw new IllegalStateException();
    }

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

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

      return true;
    }

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

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

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

      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) {
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

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

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private List<Promotion> success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Promotion.class))));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllPromotions_result.class, metaDataMap);
    }

    public getAllPromotions_result() {
    }

    public getAllPromotions_result(
      List<Promotion> success,
      PromotionException pex)
    {
      this();
      this.success = success;
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllPromotions_result(getAllPromotions_result other) {
      if (other.isSetSuccess()) {
        List<Promotion> __this__success = new ArrayList<Promotion>();
        for (Promotion other_element : other.success) {
          __this__success.add(new Promotion(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.pex = null;
    }

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

    public java.util.Iterator<Promotion> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Promotion elem) {
      if (this.success == null) {
        this.success = new ArrayList<Promotion>();
      }
      this.success.add(elem);
    }

    public List<Promotion> getSuccess() {
      return this.success;
    }

    public void setSuccess(List<Promotion> success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Promotion>)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list16 = iprot.readListBegin();
                this.success = new ArrayList<Promotion>(_list16.size);
                for (int _i17 = 0; _i17 < _list16.size; ++_i17)
                {
                  Promotion _elem18; // required
                  _elem18 = new Promotion();
                  _elem18.read(iprot);
                  this.success.add(_elem18);
                }
                iprot.readListEnd();
              }
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
          for (Promotion _iter19 : this.success)
          {
            _iter19.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PROMOTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionId", org.apache.thrift.protocol.TType.I64, (short)1);

    private long promotionId; // 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 {
      PROMOTION_ID((short)1, "promotionId");

      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: // PROMOTION_ID
            return PROMOTION_ID;
          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 __PROMOTIONID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.PROMOTION_ID, new org.apache.thrift.meta_data.FieldMetaData("promotionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPromotionById_args.class, metaDataMap);
    }

    public getPromotionById_args() {
    }

    public getPromotionById_args(
      long promotionId)
    {
      this();
      this.promotionId = promotionId;
      setPromotionIdIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPromotionById_args(getPromotionById_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.promotionId = other.promotionId;
    }

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

    @Override
    public void clear() {
      setPromotionIdIsSet(false);
      this.promotionId = 0;
    }

    public long getPromotionId() {
      return this.promotionId;
    }

    public void setPromotionId(long promotionId) {
      this.promotionId = promotionId;
      setPromotionIdIsSet(true);
    }

    public void unsetPromotionId() {
      __isset_bit_vector.clear(__PROMOTIONID_ISSET_ID);
    }

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

    public void setPromotionIdIsSet(boolean value) {
      __isset_bit_vector.set(__PROMOTIONID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROMOTION_ID:
        if (value == null) {
          unsetPromotionId();
        } else {
          setPromotionId((Long)value);
        }
        break;

      }
    }

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

      }
      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 PROMOTION_ID:
        return isSetPromotionId();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_promotionId = true;
      boolean that_present_promotionId = true;
      if (this_present_promotionId || that_present_promotionId) {
        if (!(this_present_promotionId && that_present_promotionId))
          return false;
        if (this.promotionId != that.promotionId)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPromotionId()).compareTo(typedOther.isSetPromotionId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPromotionId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionId, typedOther.promotionId);
        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: // PROMOTION_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.promotionId = iprot.readI64();
              setPromotionIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(PROMOTION_ID_FIELD_DESC);
      oprot.writeI64(this.promotionId);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("promotionId:");
      sb.append(this.promotionId);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private Promotion success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Promotion.class)));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPromotionById_result.class, metaDataMap);
    }

    public getPromotionById_result() {
    }

    public getPromotionById_result(
      Promotion success,
      PromotionException pex)
    {
      this();
      this.success = success;
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPromotionById_result(getPromotionById_result other) {
      if (other.isSetSuccess()) {
        this.success = new Promotion(other.success);
      }
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.pex = null;
    }

    public Promotion getSuccess() {
      return this.success;
    }

    public void setSuccess(Promotion success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Promotion)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.success = new Promotion();
              this.success.read(iprot);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        this.success.write(oprot);
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PROMOTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionId", org.apache.thrift.protocol.TType.I64, (short)1);
    private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)2);

    private long promotionId; // required
    private String couponCode; // 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 {
      PROMOTION_ID((short)1, "promotionId"),
      COUPON_CODE((short)2, "couponCode");

      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: // PROMOTION_ID
            return PROMOTION_ID;
          case 2: // COUPON_CODE
            return COUPON_CODE;
          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 __PROMOTIONID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.PROMOTION_ID, new org.apache.thrift.meta_data.FieldMetaData("promotionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(generateCouponsForPromotion_args.class, metaDataMap);
    }

    public generateCouponsForPromotion_args() {
    }

    public generateCouponsForPromotion_args(
      long promotionId,
      String couponCode)
    {
      this();
      this.promotionId = promotionId;
      setPromotionIdIsSet(true);
      this.couponCode = couponCode;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public generateCouponsForPromotion_args(generateCouponsForPromotion_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.promotionId = other.promotionId;
      if (other.isSetCouponCode()) {
        this.couponCode = other.couponCode;
      }
    }

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

    @Override
    public void clear() {
      setPromotionIdIsSet(false);
      this.promotionId = 0;
      this.couponCode = null;
    }

    public long getPromotionId() {
      return this.promotionId;
    }

    public void setPromotionId(long promotionId) {
      this.promotionId = promotionId;
      setPromotionIdIsSet(true);
    }

    public void unsetPromotionId() {
      __isset_bit_vector.clear(__PROMOTIONID_ISSET_ID);
    }

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

    public void setPromotionIdIsSet(boolean value) {
      __isset_bit_vector.set(__PROMOTIONID_ISSET_ID, value);
    }

    public String getCouponCode() {
      return this.couponCode;
    }

    public void setCouponCode(String couponCode) {
      this.couponCode = couponCode;
    }

    public void unsetCouponCode() {
      this.couponCode = null;
    }

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

    public void setCouponCodeIsSet(boolean value) {
      if (!value) {
        this.couponCode = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROMOTION_ID:
        if (value == null) {
          unsetPromotionId();
        } else {
          setPromotionId((Long)value);
        }
        break;

      case COUPON_CODE:
        if (value == null) {
          unsetCouponCode();
        } else {
          setCouponCode((String)value);
        }
        break;

      }
    }

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

      case COUPON_CODE:
        return getCouponCode();

      }
      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 PROMOTION_ID:
        return isSetPromotionId();
      case COUPON_CODE:
        return isSetCouponCode();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_promotionId = true;
      boolean that_present_promotionId = true;
      if (this_present_promotionId || that_present_promotionId) {
        if (!(this_present_promotionId && that_present_promotionId))
          return false;
        if (this.promotionId != that.promotionId)
          return false;
      }

      boolean this_present_couponCode = true && this.isSetCouponCode();
      boolean that_present_couponCode = true && that.isSetCouponCode();
      if (this_present_couponCode || that_present_couponCode) {
        if (!(this_present_couponCode && that_present_couponCode))
          return false;
        if (!this.couponCode.equals(that.couponCode))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPromotionId()).compareTo(typedOther.isSetPromotionId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPromotionId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionId, typedOther.promotionId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCouponCode()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
        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: // PROMOTION_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.promotionId = iprot.readI64();
              setPromotionIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 2: // COUPON_CODE
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.couponCode = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(PROMOTION_ID_FIELD_DESC);
      oprot.writeI64(this.promotionId);
      oprot.writeFieldEnd();
      if (this.couponCode != null) {
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
        oprot.writeString(this.couponCode);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("promotionId:");
      sb.append(this.promotionId);
      first = false;
      if (!first) sb.append(", ");
      sb.append("couponCode:");
      if (this.couponCode == null) {
        sb.append("null");
      } else {
        sb.append(this.couponCode);
      }
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private PromotionException pex; // 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 {
      PEX((short)1, "pex");

      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: // PEX
            return PEX;
          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

    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.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(generateCouponsForPromotion_result.class, metaDataMap);
    }

    public generateCouponsForPromotion_result() {
    }

    public generateCouponsForPromotion_result(
      PromotionException pex)
    {
      this();
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public generateCouponsForPromotion_result(generateCouponsForPromotion_result other) {
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.pex = null;
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PEX:
        return getPex();

      }
      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 PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)1);
    private static final org.apache.thrift.protocol.TField CART_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("cartId", org.apache.thrift.protocol.TType.I64, (short)2);

    private String couponCode; // required
    private long cartId; // 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 {
      COUPON_CODE((short)1, "couponCode"),
      CART_ID((short)2, "cartId");

      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: // COUPON_CODE
            return COUPON_CODE;
          case 2: // CART_ID
            return CART_ID;
          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 __CARTID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.CART_ID, new org.apache.thrift.meta_data.FieldMetaData("cartId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(applyCoupon_args.class, metaDataMap);
    }

    public applyCoupon_args() {
    }

    public applyCoupon_args(
      String couponCode,
      long cartId)
    {
      this();
      this.couponCode = couponCode;
      this.cartId = cartId;
      setCartIdIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public applyCoupon_args(applyCoupon_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      if (other.isSetCouponCode()) {
        this.couponCode = other.couponCode;
      }
      this.cartId = other.cartId;
    }

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

    @Override
    public void clear() {
      this.couponCode = null;
      setCartIdIsSet(false);
      this.cartId = 0;
    }

    public String getCouponCode() {
      return this.couponCode;
    }

    public void setCouponCode(String couponCode) {
      this.couponCode = couponCode;
    }

    public void unsetCouponCode() {
      this.couponCode = null;
    }

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

    public void setCouponCodeIsSet(boolean value) {
      if (!value) {
        this.couponCode = null;
      }
    }

    public long getCartId() {
      return this.cartId;
    }

    public void setCartId(long cartId) {
      this.cartId = cartId;
      setCartIdIsSet(true);
    }

    public void unsetCartId() {
      __isset_bit_vector.clear(__CARTID_ISSET_ID);
    }

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

    public void setCartIdIsSet(boolean value) {
      __isset_bit_vector.set(__CARTID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case COUPON_CODE:
        if (value == null) {
          unsetCouponCode();
        } else {
          setCouponCode((String)value);
        }
        break;

      case CART_ID:
        if (value == null) {
          unsetCartId();
        } else {
          setCartId((Long)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case COUPON_CODE:
        return getCouponCode();

      case CART_ID:
        return Long.valueOf(getCartId());

      }
      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 COUPON_CODE:
        return isSetCouponCode();
      case CART_ID:
        return isSetCartId();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_couponCode = true && this.isSetCouponCode();
      boolean that_present_couponCode = true && that.isSetCouponCode();
      if (this_present_couponCode || that_present_couponCode) {
        if (!(this_present_couponCode && that_present_couponCode))
          return false;
        if (!this.couponCode.equals(that.couponCode))
          return false;
      }

      boolean this_present_cartId = true;
      boolean that_present_cartId = true;
      if (this_present_cartId || that_present_cartId) {
        if (!(this_present_cartId && that_present_cartId))
          return false;
        if (this.cartId != that.cartId)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCouponCode()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetCartId()).compareTo(typedOther.isSetCartId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCartId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cartId, typedOther.cartId);
        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: // COUPON_CODE
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.couponCode = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 2: // CART_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.cartId = iprot.readI64();
              setCartIdIsSet(true);
            } 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.couponCode != null) {
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
        oprot.writeString(this.couponCode);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(CART_ID_FIELD_DESC);
      oprot.writeI64(this.cartId);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("couponCode:");
      if (this.couponCode == null) {
        sb.append("null");
      } else {
        sb.append(this.couponCode);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cartId:");
      sb.append(this.cartId);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private Cart success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Cart.class)));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(applyCoupon_result.class, metaDataMap);
    }

    public applyCoupon_result() {
    }

    public applyCoupon_result(
      Cart success,
      PromotionException pex)
    {
      this();
      this.success = success;
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public applyCoupon_result(applyCoupon_result other) {
      if (other.isSetSuccess()) {
        this.success = new Cart(other.success);
      }
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.pex = null;
    }

    public Cart getSuccess() {
      return this.success;
    }

    public void setSuccess(Cart success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Cart)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.success = new Cart();
              this.success.read(iprot);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        this.success.write(oprot);
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField CART_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("cartId", org.apache.thrift.protocol.TType.I64, (short)1);

    private long cartId; // 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 {
      CART_ID((short)1, "cartId");

      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: // CART_ID
            return CART_ID;
          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 __CARTID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.CART_ID, new org.apache.thrift.meta_data.FieldMetaData("cartId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getEmiDiscount_args.class, metaDataMap);
    }

    public getEmiDiscount_args() {
    }

    public getEmiDiscount_args(
      long cartId)
    {
      this();
      this.cartId = cartId;
      setCartIdIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getEmiDiscount_args(getEmiDiscount_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.cartId = other.cartId;
    }

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

    @Override
    public void clear() {
      setCartIdIsSet(false);
      this.cartId = 0;
    }

    public long getCartId() {
      return this.cartId;
    }

    public void setCartId(long cartId) {
      this.cartId = cartId;
      setCartIdIsSet(true);
    }

    public void unsetCartId() {
      __isset_bit_vector.clear(__CARTID_ISSET_ID);
    }

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

    public void setCartIdIsSet(boolean value) {
      __isset_bit_vector.set(__CARTID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case CART_ID:
        if (value == null) {
          unsetCartId();
        } else {
          setCartId((Long)value);
        }
        break;

      }
    }

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

      }
      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 CART_ID:
        return isSetCartId();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_cartId = true;
      boolean that_present_cartId = true;
      if (this_present_cartId || that_present_cartId) {
        if (!(this_present_cartId && that_present_cartId))
          return false;
        if (this.cartId != that.cartId)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCartId()).compareTo(typedOther.isSetCartId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCartId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cartId, typedOther.cartId);
        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: // CART_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.cartId = iprot.readI64();
              setCartIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(CART_ID_FIELD_DESC);
      oprot.writeI64(this.cartId);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("cartId:");
      sb.append(this.cartId);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.MAP, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private Map<Long,Double> success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
              new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64), 
              new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getEmiDiscount_result.class, metaDataMap);
    }

    public getEmiDiscount_result() {
    }

    public getEmiDiscount_result(
      Map<Long,Double> success,
      PromotionException pex)
    {
      this();
      this.success = success;
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getEmiDiscount_result(getEmiDiscount_result other) {
      if (other.isSetSuccess()) {
        Map<Long,Double> __this__success = new HashMap<Long,Double>();
        for (Map.Entry<Long, Double> other_element : other.success.entrySet()) {

          Long other_element_key = other_element.getKey();
          Double other_element_value = other_element.getValue();

          Long __this__success_copy_key = other_element_key;

          Double __this__success_copy_value = other_element_value;

          __this__success.put(__this__success_copy_key, __this__success_copy_value);
        }
        this.success = __this__success;
      }
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.pex = null;
    }

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

    public void putToSuccess(long key, double val) {
      if (this.success == null) {
        this.success = new HashMap<Long,Double>();
      }
      this.success.put(key, val);
    }

    public Map<Long,Double> getSuccess() {
      return this.success;
    }

    public void setSuccess(Map<Long,Double> success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Map<Long,Double>)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map20 = iprot.readMapBegin();
                this.success = new HashMap<Long,Double>(2*_map20.size);
                for (int _i21 = 0; _i21 < _map20.size; ++_i21)
                {
                  long _key22; // required
                  double _val23; // required
                  _key22 = iprot.readI64();
                  _val23 = iprot.readDouble();
                  this.success.put(_key22, _val23);
                }
                iprot.readMapEnd();
              }
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.DOUBLE, this.success.size()));
          for (Map.Entry<Long, Double> _iter24 : this.success.entrySet())
          {
            oprot.writeI64(_iter24.getKey());
            oprot.writeDouble(_iter24.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)1);
    private static final org.apache.thrift.protocol.TField TOTAL_AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("totalAmount", org.apache.thrift.protocol.TType.I64, (short)2);
    private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.I64, (short)3);

    private String couponCode; // required
    private long totalAmount; // required
    private long userId; // 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 {
      COUPON_CODE((short)1, "couponCode"),
      TOTAL_AMOUNT((short)2, "totalAmount"),
      USER_ID((short)3, "userId");

      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: // COUPON_CODE
            return COUPON_CODE;
          case 2: // TOTAL_AMOUNT
            return TOTAL_AMOUNT;
          case 3: // USER_ID
            return USER_ID;
          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 __TOTALAMOUNT_ISSET_ID = 0;
    private static final int __USERID_ISSET_ID = 1;
    private BitSet __isset_bit_vector = new BitSet(2);

    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.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.TOTAL_AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("totalAmount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(applyRechargeCoupon_args.class, metaDataMap);
    }

    public applyRechargeCoupon_args() {
    }

    public applyRechargeCoupon_args(
      String couponCode,
      long totalAmount,
      long userId)
    {
      this();
      this.couponCode = couponCode;
      this.totalAmount = totalAmount;
      setTotalAmountIsSet(true);
      this.userId = userId;
      setUserIdIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public applyRechargeCoupon_args(applyRechargeCoupon_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      if (other.isSetCouponCode()) {
        this.couponCode = other.couponCode;
      }
      this.totalAmount = other.totalAmount;
      this.userId = other.userId;
    }

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

    @Override
    public void clear() {
      this.couponCode = null;
      setTotalAmountIsSet(false);
      this.totalAmount = 0;
      setUserIdIsSet(false);
      this.userId = 0;
    }

    public String getCouponCode() {
      return this.couponCode;
    }

    public void setCouponCode(String couponCode) {
      this.couponCode = couponCode;
    }

    public void unsetCouponCode() {
      this.couponCode = null;
    }

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

    public void setCouponCodeIsSet(boolean value) {
      if (!value) {
        this.couponCode = null;
      }
    }

    public long getTotalAmount() {
      return this.totalAmount;
    }

    public void setTotalAmount(long totalAmount) {
      this.totalAmount = totalAmount;
      setTotalAmountIsSet(true);
    }

    public void unsetTotalAmount() {
      __isset_bit_vector.clear(__TOTALAMOUNT_ISSET_ID);
    }

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

    public void setTotalAmountIsSet(boolean value) {
      __isset_bit_vector.set(__TOTALAMOUNT_ISSET_ID, value);
    }

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

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

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

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

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

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case COUPON_CODE:
        if (value == null) {
          unsetCouponCode();
        } else {
          setCouponCode((String)value);
        }
        break;

      case TOTAL_AMOUNT:
        if (value == null) {
          unsetTotalAmount();
        } else {
          setTotalAmount((Long)value);
        }
        break;

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

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case COUPON_CODE:
        return getCouponCode();

      case TOTAL_AMOUNT:
        return Long.valueOf(getTotalAmount());

      case USER_ID:
        return Long.valueOf(getUserId());

      }
      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 COUPON_CODE:
        return isSetCouponCode();
      case TOTAL_AMOUNT:
        return isSetTotalAmount();
      case USER_ID:
        return isSetUserId();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_couponCode = true && this.isSetCouponCode();
      boolean that_present_couponCode = true && that.isSetCouponCode();
      if (this_present_couponCode || that_present_couponCode) {
        if (!(this_present_couponCode && that_present_couponCode))
          return false;
        if (!this.couponCode.equals(that.couponCode))
          return false;
      }

      boolean this_present_totalAmount = true;
      boolean that_present_totalAmount = true;
      if (this_present_totalAmount || that_present_totalAmount) {
        if (!(this_present_totalAmount && that_present_totalAmount))
          return false;
        if (this.totalAmount != that.totalAmount)
          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;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCouponCode()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetTotalAmount()).compareTo(typedOther.isSetTotalAmount());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetTotalAmount()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.totalAmount, typedOther.totalAmount);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      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: // COUPON_CODE
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.couponCode = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 2: // TOTAL_AMOUNT
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.totalAmount = iprot.readI64();
              setTotalAmountIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 3: // USER_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.userId = iprot.readI64();
              setUserIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          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.couponCode != null) {
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
        oprot.writeString(this.couponCode);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(TOTAL_AMOUNT_FIELD_DESC);
      oprot.writeI64(this.totalAmount);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(USER_ID_FIELD_DESC);
      oprot.writeI64(this.userId);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("couponCode:");
      if (this.couponCode == null) {
        sb.append("null");
      } else {
        sb.append(this.couponCode);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("totalAmount:");
      sb.append(this.totalAmount);
      first = false;
      if (!first) sb.append(", ");
      sb.append("userId:");
      sb.append(this.userId);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.MAP, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private Map<Long,String> success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
              new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64), 
              new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(applyRechargeCoupon_result.class, metaDataMap);
    }

    public applyRechargeCoupon_result() {
    }

    public applyRechargeCoupon_result(
      Map<Long,String> success,
      PromotionException pex)
    {
      this();
      this.success = success;
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public applyRechargeCoupon_result(applyRechargeCoupon_result other) {
      if (other.isSetSuccess()) {
        Map<Long,String> __this__success = new HashMap<Long,String>();
        for (Map.Entry<Long, String> other_element : other.success.entrySet()) {

          Long other_element_key = other_element.getKey();
          String other_element_value = other_element.getValue();

          Long __this__success_copy_key = other_element_key;

          String __this__success_copy_value = other_element_value;

          __this__success.put(__this__success_copy_key, __this__success_copy_value);
        }
        this.success = __this__success;
      }
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.pex = null;
    }

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

    public void putToSuccess(long key, String val) {
      if (this.success == null) {
        this.success = new HashMap<Long,String>();
      }
      this.success.put(key, val);
    }

    public Map<Long,String> getSuccess() {
      return this.success;
    }

    public void setSuccess(Map<Long,String> success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Map<Long,String>)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map25 = iprot.readMapBegin();
                this.success = new HashMap<Long,String>(2*_map25.size);
                for (int _i26 = 0; _i26 < _map25.size; ++_i26)
                {
                  long _key27; // required
                  String _val28; // required
                  _key27 = iprot.readI64();
                  _val28 = iprot.readString();
                  this.success.put(_key27, _val28);
                }
                iprot.readMapEnd();
              }
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.STRING, this.success.size()));
          for (Map.Entry<Long, String> _iter29 : this.success.entrySet())
          {
            oprot.writeI64(_iter29.getKey());
            oprot.writeString(_iter29.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)1);
    private static final org.apache.thrift.protocol.TField TRANSACTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("transactionId", org.apache.thrift.protocol.TType.I64, (short)2);
    private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.I64, (short)3);
    private static final org.apache.thrift.protocol.TField AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("amount", org.apache.thrift.protocol.TType.I64, (short)4);
    private static final org.apache.thrift.protocol.TField IS_DIGITAL_FIELD_DESC = new org.apache.thrift.protocol.TField("isDigital", org.apache.thrift.protocol.TType.BOOL, (short)5);

    private String couponCode; // required
    private long transactionId; // required
    private long userId; // required
    private long amount; // required
    private boolean isDigital; // 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 {
      COUPON_CODE((short)1, "couponCode"),
      TRANSACTION_ID((short)2, "transactionId"),
      USER_ID((short)3, "userId"),
      AMOUNT((short)4, "amount"),
      IS_DIGITAL((short)5, "isDigital");

      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: // COUPON_CODE
            return COUPON_CODE;
          case 2: // TRANSACTION_ID
            return TRANSACTION_ID;
          case 3: // USER_ID
            return USER_ID;
          case 4: // AMOUNT
            return AMOUNT;
          case 5: // IS_DIGITAL
            return IS_DIGITAL;
          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 __TRANSACTIONID_ISSET_ID = 0;
    private static final int __USERID_ISSET_ID = 1;
    private static final int __AMOUNT_ISSET_ID = 2;
    private static final int __ISDIGITAL_ISSET_ID = 3;
    private BitSet __isset_bit_vector = new BitSet(4);

    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.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.TRANSACTION_ID, new org.apache.thrift.meta_data.FieldMetaData("transactionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("amount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.IS_DIGITAL, new org.apache.thrift.meta_data.FieldMetaData("isDigital", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(trackCouponUsage_args.class, metaDataMap);
    }

    public trackCouponUsage_args() {
    }

    public trackCouponUsage_args(
      String couponCode,
      long transactionId,
      long userId,
      long amount,
      boolean isDigital)
    {
      this();
      this.couponCode = couponCode;
      this.transactionId = transactionId;
      setTransactionIdIsSet(true);
      this.userId = userId;
      setUserIdIsSet(true);
      this.amount = amount;
      setAmountIsSet(true);
      this.isDigital = isDigital;
      setIsDigitalIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public trackCouponUsage_args(trackCouponUsage_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      if (other.isSetCouponCode()) {
        this.couponCode = other.couponCode;
      }
      this.transactionId = other.transactionId;
      this.userId = other.userId;
      this.amount = other.amount;
      this.isDigital = other.isDigital;
    }

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

    @Override
    public void clear() {
      this.couponCode = null;
      setTransactionIdIsSet(false);
      this.transactionId = 0;
      setUserIdIsSet(false);
      this.userId = 0;
      setAmountIsSet(false);
      this.amount = 0;
      setIsDigitalIsSet(false);
      this.isDigital = false;
    }

    public String getCouponCode() {
      return this.couponCode;
    }

    public void setCouponCode(String couponCode) {
      this.couponCode = couponCode;
    }

    public void unsetCouponCode() {
      this.couponCode = null;
    }

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

    public void setCouponCodeIsSet(boolean value) {
      if (!value) {
        this.couponCode = null;
      }
    }

    public long getTransactionId() {
      return this.transactionId;
    }

    public void setTransactionId(long transactionId) {
      this.transactionId = transactionId;
      setTransactionIdIsSet(true);
    }

    public void unsetTransactionId() {
      __isset_bit_vector.clear(__TRANSACTIONID_ISSET_ID);
    }

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

    public void setTransactionIdIsSet(boolean value) {
      __isset_bit_vector.set(__TRANSACTIONID_ISSET_ID, value);
    }

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

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

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

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

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

    public long getAmount() {
      return this.amount;
    }

    public void setAmount(long amount) {
      this.amount = amount;
      setAmountIsSet(true);
    }

    public void unsetAmount() {
      __isset_bit_vector.clear(__AMOUNT_ISSET_ID);
    }

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

    public void setAmountIsSet(boolean value) {
      __isset_bit_vector.set(__AMOUNT_ISSET_ID, value);
    }

    public boolean isIsDigital() {
      return this.isDigital;
    }

    public void setIsDigital(boolean isDigital) {
      this.isDigital = isDigital;
      setIsDigitalIsSet(true);
    }

    public void unsetIsDigital() {
      __isset_bit_vector.clear(__ISDIGITAL_ISSET_ID);
    }

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

    public void setIsDigitalIsSet(boolean value) {
      __isset_bit_vector.set(__ISDIGITAL_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case COUPON_CODE:
        if (value == null) {
          unsetCouponCode();
        } else {
          setCouponCode((String)value);
        }
        break;

      case TRANSACTION_ID:
        if (value == null) {
          unsetTransactionId();
        } else {
          setTransactionId((Long)value);
        }
        break;

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

      case AMOUNT:
        if (value == null) {
          unsetAmount();
        } else {
          setAmount((Long)value);
        }
        break;

      case IS_DIGITAL:
        if (value == null) {
          unsetIsDigital();
        } else {
          setIsDigital((Boolean)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case COUPON_CODE:
        return getCouponCode();

      case TRANSACTION_ID:
        return Long.valueOf(getTransactionId());

      case USER_ID:
        return Long.valueOf(getUserId());

      case AMOUNT:
        return Long.valueOf(getAmount());

      case IS_DIGITAL:
        return Boolean.valueOf(isIsDigital());

      }
      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 COUPON_CODE:
        return isSetCouponCode();
      case TRANSACTION_ID:
        return isSetTransactionId();
      case USER_ID:
        return isSetUserId();
      case AMOUNT:
        return isSetAmount();
      case IS_DIGITAL:
        return isSetIsDigital();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_couponCode = true && this.isSetCouponCode();
      boolean that_present_couponCode = true && that.isSetCouponCode();
      if (this_present_couponCode || that_present_couponCode) {
        if (!(this_present_couponCode && that_present_couponCode))
          return false;
        if (!this.couponCode.equals(that.couponCode))
          return false;
      }

      boolean this_present_transactionId = true;
      boolean that_present_transactionId = true;
      if (this_present_transactionId || that_present_transactionId) {
        if (!(this_present_transactionId && that_present_transactionId))
          return false;
        if (this.transactionId != that.transactionId)
          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_amount = true;
      boolean that_present_amount = true;
      if (this_present_amount || that_present_amount) {
        if (!(this_present_amount && that_present_amount))
          return false;
        if (this.amount != that.amount)
          return false;
      }

      boolean this_present_isDigital = true;
      boolean that_present_isDigital = true;
      if (this_present_isDigital || that_present_isDigital) {
        if (!(this_present_isDigital && that_present_isDigital))
          return false;
        if (this.isDigital != that.isDigital)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCouponCode()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetTransactionId()).compareTo(typedOther.isSetTransactionId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetTransactionId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.transactionId, typedOther.transactionId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetAmount()).compareTo(typedOther.isSetAmount());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetAmount()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.amount, typedOther.amount);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetIsDigital()).compareTo(typedOther.isSetIsDigital());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetIsDigital()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isDigital, typedOther.isDigital);
        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: // COUPON_CODE
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.couponCode = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 2: // TRANSACTION_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.transactionId = iprot.readI64();
              setTransactionIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 3: // USER_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.userId = iprot.readI64();
              setUserIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 4: // AMOUNT
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.amount = iprot.readI64();
              setAmountIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 5: // IS_DIGITAL
            if (field.type == org.apache.thrift.protocol.TType.BOOL) {
              this.isDigital = iprot.readBool();
              setIsDigitalIsSet(true);
            } 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.couponCode != null) {
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
        oprot.writeString(this.couponCode);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(TRANSACTION_ID_FIELD_DESC);
      oprot.writeI64(this.transactionId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(USER_ID_FIELD_DESC);
      oprot.writeI64(this.userId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
      oprot.writeI64(this.amount);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(IS_DIGITAL_FIELD_DESC);
      oprot.writeBool(this.isDigital);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("couponCode:");
      if (this.couponCode == null) {
        sb.append("null");
      } else {
        sb.append(this.couponCode);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("transactionId:");
      sb.append(this.transactionId);
      first = false;
      if (!first) sb.append(", ");
      sb.append("userId:");
      sb.append(this.userId);
      first = false;
      if (!first) sb.append(", ");
      sb.append("amount:");
      sb.append(this.amount);
      first = false;
      if (!first) sb.append(", ");
      sb.append("isDigital:");
      sb.append(this.isDigital);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private PromotionException pex; // 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 {
      PEX((short)1, "pex");

      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: // PEX
            return PEX;
          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

    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.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(trackCouponUsage_result.class, metaDataMap);
    }

    public trackCouponUsage_result() {
    }

    public trackCouponUsage_result(
      PromotionException pex)
    {
      this();
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public trackCouponUsage_result(trackCouponUsage_result other) {
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.pex = null;
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PEX:
        return getPex();

      }
      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 PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)1);
    private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.I64, (short)2);

    private String couponCode; // required
    private long userId; // 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 {
      COUPON_CODE((short)1, "couponCode"),
      USER_ID((short)2, "userId");

      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: // COUPON_CODE
            return COUPON_CODE;
          case 2: // USER_ID
            return USER_ID;
          default:
            return null;
        }
      }

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

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

      private final short _thriftId;
      private final String _fieldName;

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

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    private static final int __USERID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getCouponUsageCountByUser_args.class, metaDataMap);
    }

    public getCouponUsageCountByUser_args() {
    }

    public getCouponUsageCountByUser_args(
      String couponCode,
      long userId)
    {
      this();
      this.couponCode = couponCode;
      this.userId = userId;
      setUserIdIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getCouponUsageCountByUser_args(getCouponUsageCountByUser_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      if (other.isSetCouponCode()) {
        this.couponCode = other.couponCode;
      }
      this.userId = other.userId;
    }

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

    @Override
    public void clear() {
      this.couponCode = null;
      setUserIdIsSet(false);
      this.userId = 0;
    }

    public String getCouponCode() {
      return this.couponCode;
    }

    public void setCouponCode(String couponCode) {
      this.couponCode = couponCode;
    }

    public void unsetCouponCode() {
      this.couponCode = null;
    }

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

    public void setCouponCodeIsSet(boolean value) {
      if (!value) {
        this.couponCode = null;
      }
    }

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

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

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

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

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

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case COUPON_CODE:
        if (value == null) {
          unsetCouponCode();
        } else {
          setCouponCode((String)value);
        }
        break;

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

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case COUPON_CODE:
        return getCouponCode();

      case USER_ID:
        return Long.valueOf(getUserId());

      }
      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 COUPON_CODE:
        return isSetCouponCode();
      case USER_ID:
        return isSetUserId();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_couponCode = true && this.isSetCouponCode();
      boolean that_present_couponCode = true && that.isSetCouponCode();
      if (this_present_couponCode || that_present_couponCode) {
        if (!(this_present_couponCode && that_present_couponCode))
          return false;
        if (!this.couponCode.equals(that.couponCode))
          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;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCouponCode()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      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: // COUPON_CODE
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.couponCode = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 2: // USER_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.userId = iprot.readI64();
              setUserIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          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.couponCode != null) {
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
        oprot.writeString(this.couponCode);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(USER_ID_FIELD_DESC);
      oprot.writeI64(this.userId);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("couponCode:");
      if (this.couponCode == null) {
        sb.append("null");
      } else {
        sb.append(this.couponCode);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("userId:");
      sb.append(this.userId);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I64, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private long success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getCouponUsageCountByUser_result.class, metaDataMap);
    }

    public getCouponUsageCountByUser_result() {
    }

    public getCouponUsageCountByUser_result(
      long success,
      PromotionException pex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getCouponUsageCountByUser_result(getCouponUsageCountByUser_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      setSuccessIsSet(false);
      this.success = 0;
      this.pex = null;
    }

    public long getSuccess() {
      return this.success;
    }

    public void setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Long)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

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

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.success = iprot.readI64();
              setSuccessIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeI64(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PROMOTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionId", org.apache.thrift.protocol.TType.I64, (short)1);

    private long promotionId; // 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 {
      PROMOTION_ID((short)1, "promotionId");

      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: // PROMOTION_ID
            return PROMOTION_ID;
          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 __PROMOTIONID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.PROMOTION_ID, new org.apache.thrift.meta_data.FieldMetaData("promotionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getActiveCodes_args.class, metaDataMap);
    }

    public getActiveCodes_args() {
    }

    public getActiveCodes_args(
      long promotionId)
    {
      this();
      this.promotionId = promotionId;
      setPromotionIdIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getActiveCodes_args(getActiveCodes_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.promotionId = other.promotionId;
    }

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

    @Override
    public void clear() {
      setPromotionIdIsSet(false);
      this.promotionId = 0;
    }

    public long getPromotionId() {
      return this.promotionId;
    }

    public void setPromotionId(long promotionId) {
      this.promotionId = promotionId;
      setPromotionIdIsSet(true);
    }

    public void unsetPromotionId() {
      __isset_bit_vector.clear(__PROMOTIONID_ISSET_ID);
    }

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

    public void setPromotionIdIsSet(boolean value) {
      __isset_bit_vector.set(__PROMOTIONID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROMOTION_ID:
        if (value == null) {
          unsetPromotionId();
        } else {
          setPromotionId((Long)value);
        }
        break;

      }
    }

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

      }
      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 PROMOTION_ID:
        return isSetPromotionId();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_promotionId = true;
      boolean that_present_promotionId = true;
      if (this_present_promotionId || that_present_promotionId) {
        if (!(this_present_promotionId && that_present_promotionId))
          return false;
        if (this.promotionId != that.promotionId)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPromotionId()).compareTo(typedOther.isSetPromotionId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPromotionId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionId, typedOther.promotionId);
        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: // PROMOTION_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.promotionId = iprot.readI64();
              setPromotionIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(PROMOTION_ID_FIELD_DESC);
      oprot.writeI64(this.promotionId);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("promotionId:");
      sb.append(this.promotionId);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private List<Coupon> success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Coupon.class))));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getActiveCodes_result.class, metaDataMap);
    }

    public getActiveCodes_result() {
    }

    public getActiveCodes_result(
      List<Coupon> success,
      PromotionException pex)
    {
      this();
      this.success = success;
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getActiveCodes_result(getActiveCodes_result other) {
      if (other.isSetSuccess()) {
        List<Coupon> __this__success = new ArrayList<Coupon>();
        for (Coupon other_element : other.success) {
          __this__success.add(new Coupon(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.pex = null;
    }

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

    public java.util.Iterator<Coupon> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Coupon elem) {
      if (this.success == null) {
        this.success = new ArrayList<Coupon>();
      }
      this.success.add(elem);
    }

    public List<Coupon> getSuccess() {
      return this.success;
    }

    public void setSuccess(List<Coupon> success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Coupon>)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list30 = iprot.readListBegin();
                this.success = new ArrayList<Coupon>(_list30.size);
                for (int _i31 = 0; _i31 < _list30.size; ++_i31)
                {
                  Coupon _elem32; // required
                  _elem32 = new Coupon();
                  _elem32.read(iprot);
                  this.success.add(_elem32);
                }
                iprot.readListEnd();
              }
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
          for (Coupon _iter33 : this.success)
          {
            _iter33.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)1);

    private String couponCode; // 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 {
      COUPON_CODE((short)1, "couponCode");

      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: // COUPON_CODE
            return COUPON_CODE;
          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

    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.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(deleteCoupon_args.class, metaDataMap);
    }

    public deleteCoupon_args() {
    }

    public deleteCoupon_args(
      String couponCode)
    {
      this();
      this.couponCode = couponCode;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public deleteCoupon_args(deleteCoupon_args other) {
      if (other.isSetCouponCode()) {
        this.couponCode = other.couponCode;
      }
    }

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

    @Override
    public void clear() {
      this.couponCode = null;
    }

    public String getCouponCode() {
      return this.couponCode;
    }

    public void setCouponCode(String couponCode) {
      this.couponCode = couponCode;
    }

    public void unsetCouponCode() {
      this.couponCode = null;
    }

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

    public void setCouponCodeIsSet(boolean value) {
      if (!value) {
        this.couponCode = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case COUPON_CODE:
        if (value == null) {
          unsetCouponCode();
        } else {
          setCouponCode((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case COUPON_CODE:
        return getCouponCode();

      }
      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 COUPON_CODE:
        return isSetCouponCode();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_couponCode = true && this.isSetCouponCode();
      boolean that_present_couponCode = true && that.isSetCouponCode();
      if (this_present_couponCode || that_present_couponCode) {
        if (!(this_present_couponCode && that_present_couponCode))
          return false;
        if (!this.couponCode.equals(that.couponCode))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCouponCode()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
        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: // COUPON_CODE
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.couponCode = iprot.readString();
            } 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.couponCode != null) {
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
        oprot.writeString(this.couponCode);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("couponCode:");
      if (this.couponCode == null) {
        sb.append("null");
      } else {
        sb.append(this.couponCode);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private PromotionException pex; // 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 {
      PEX((short)1, "pex");

      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: // PEX
            return PEX;
          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

    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.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(deleteCoupon_result.class, metaDataMap);
    }

    public deleteCoupon_result() {
    }

    public deleteCoupon_result(
      PromotionException pex)
    {
      this();
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public deleteCoupon_result(deleteCoupon_result other) {
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.pex = null;
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PEX:
        return getPex();

      }
      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 PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PROMOTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionId", org.apache.thrift.protocol.TType.I64, (short)1);

    private long promotionId; // 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 {
      PROMOTION_ID((short)1, "promotionId");

      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: // PROMOTION_ID
            return PROMOTION_ID;
          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 __PROMOTIONID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.PROMOTION_ID, new org.apache.thrift.meta_data.FieldMetaData("promotionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllCouponsByPromotionId_args.class, metaDataMap);
    }

    public getAllCouponsByPromotionId_args() {
    }

    public getAllCouponsByPromotionId_args(
      long promotionId)
    {
      this();
      this.promotionId = promotionId;
      setPromotionIdIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllCouponsByPromotionId_args(getAllCouponsByPromotionId_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.promotionId = other.promotionId;
    }

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

    @Override
    public void clear() {
      setPromotionIdIsSet(false);
      this.promotionId = 0;
    }

    public long getPromotionId() {
      return this.promotionId;
    }

    public void setPromotionId(long promotionId) {
      this.promotionId = promotionId;
      setPromotionIdIsSet(true);
    }

    public void unsetPromotionId() {
      __isset_bit_vector.clear(__PROMOTIONID_ISSET_ID);
    }

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

    public void setPromotionIdIsSet(boolean value) {
      __isset_bit_vector.set(__PROMOTIONID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROMOTION_ID:
        if (value == null) {
          unsetPromotionId();
        } else {
          setPromotionId((Long)value);
        }
        break;

      }
    }

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

      }
      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 PROMOTION_ID:
        return isSetPromotionId();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_promotionId = true;
      boolean that_present_promotionId = true;
      if (this_present_promotionId || that_present_promotionId) {
        if (!(this_present_promotionId && that_present_promotionId))
          return false;
        if (this.promotionId != that.promotionId)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPromotionId()).compareTo(typedOther.isSetPromotionId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPromotionId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionId, typedOther.promotionId);
        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: // PROMOTION_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.promotionId = iprot.readI64();
              setPromotionIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(PROMOTION_ID_FIELD_DESC);
      oprot.writeI64(this.promotionId);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("promotionId:");
      sb.append(this.promotionId);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private List<Coupon> success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Coupon.class))));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllCouponsByPromotionId_result.class, metaDataMap);
    }

    public getAllCouponsByPromotionId_result() {
    }

    public getAllCouponsByPromotionId_result(
      List<Coupon> success,
      PromotionException pex)
    {
      this();
      this.success = success;
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllCouponsByPromotionId_result(getAllCouponsByPromotionId_result other) {
      if (other.isSetSuccess()) {
        List<Coupon> __this__success = new ArrayList<Coupon>();
        for (Coupon other_element : other.success) {
          __this__success.add(new Coupon(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.pex = null;
    }

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

    public java.util.Iterator<Coupon> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Coupon elem) {
      if (this.success == null) {
        this.success = new ArrayList<Coupon>();
      }
      this.success.add(elem);
    }

    public List<Coupon> getSuccess() {
      return this.success;
    }

    public void setSuccess(List<Coupon> success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Coupon>)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list34 = iprot.readListBegin();
                this.success = new ArrayList<Coupon>(_list34.size);
                for (int _i35 = 0; _i35 < _list34.size; ++_i35)
                {
                  Coupon _elem36; // required
                  _elem36 = new Coupon();
                  _elem36.read(iprot);
                  this.success.add(_elem36);
                }
                iprot.readListEnd();
              }
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
          for (Coupon _iter37 : this.success)
          {
            _iter37.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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



    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
;

      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) {
          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;
      }
    }
    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);
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getActiveCoupons_args.class, metaDataMap);
    }

    public getActiveCoupons_args() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getActiveCoupons_args(getActiveCoupons_args other) {
    }

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

    @Override
    public void clear() {
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      }
      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) {
      }
      throw new IllegalStateException();
    }

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

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

      return true;
    }

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

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

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

      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) {
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

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

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private List<Coupon> success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Coupon.class))));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getActiveCoupons_result.class, metaDataMap);
    }

    public getActiveCoupons_result() {
    }

    public getActiveCoupons_result(
      List<Coupon> success,
      PromotionException pex)
    {
      this();
      this.success = success;
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getActiveCoupons_result(getActiveCoupons_result other) {
      if (other.isSetSuccess()) {
        List<Coupon> __this__success = new ArrayList<Coupon>();
        for (Coupon other_element : other.success) {
          __this__success.add(new Coupon(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.pex = null;
    }

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

    public java.util.Iterator<Coupon> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Coupon elem) {
      if (this.success == null) {
        this.success = new ArrayList<Coupon>();
      }
      this.success.add(elem);
    }

    public List<Coupon> getSuccess() {
      return this.success;
    }

    public void setSuccess(List<Coupon> success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Coupon>)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list38 = iprot.readListBegin();
                this.success = new ArrayList<Coupon>(_list38.size);
                for (int _i39 = 0; _i39 < _list38.size; ++_i39)
                {
                  Coupon _elem40; // required
                  _elem40 = new Coupon();
                  _elem40.read(iprot);
                  this.success.add(_elem40);
                }
                iprot.readListEnd();
              }
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
          for (Coupon _iter41 : this.success)
          {
            _iter41.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PROMOTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionId", org.apache.thrift.protocol.TType.I64, (short)1);
    private static final org.apache.thrift.protocol.TField COUPON_CATEGORY_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCategory", org.apache.thrift.protocol.TType.I64, (short)2);
    private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)3);
    private static final org.apache.thrift.protocol.TField ARGUMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("arguments", org.apache.thrift.protocol.TType.STRING, (short)4);
    private static final org.apache.thrift.protocol.TField IS_COD_FIELD_DESC = new org.apache.thrift.protocol.TField("isCod", org.apache.thrift.protocol.TType.BOOL, (short)5);
    private static final org.apache.thrift.protocol.TField PREFIX_FIELD_DESC = new org.apache.thrift.protocol.TField("prefix", org.apache.thrift.protocol.TType.STRING, (short)6);

    private long promotionId; // required
    private long couponCategory; // required
    private String couponCode; // required
    private String arguments; // required
    private boolean isCod; // required
    private String prefix; // 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 {
      PROMOTION_ID((short)1, "promotionId"),
      COUPON_CATEGORY((short)2, "couponCategory"),
      COUPON_CODE((short)3, "couponCode"),
      ARGUMENTS((short)4, "arguments"),
      IS_COD((short)5, "isCod"),
      PREFIX((short)6, "prefix");

      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: // PROMOTION_ID
            return PROMOTION_ID;
          case 2: // COUPON_CATEGORY
            return COUPON_CATEGORY;
          case 3: // COUPON_CODE
            return COUPON_CODE;
          case 4: // ARGUMENTS
            return ARGUMENTS;
          case 5: // IS_COD
            return IS_COD;
          case 6: // PREFIX
            return PREFIX;
          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 __PROMOTIONID_ISSET_ID = 0;
    private static final int __COUPONCATEGORY_ISSET_ID = 1;
    private static final int __ISCOD_ISSET_ID = 2;
    private BitSet __isset_bit_vector = new BitSet(3);

    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.PROMOTION_ID, new org.apache.thrift.meta_data.FieldMetaData("promotionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.COUPON_CATEGORY, new org.apache.thrift.meta_data.FieldMetaData("couponCategory", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.ARGUMENTS, new org.apache.thrift.meta_data.FieldMetaData("arguments", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.IS_COD, new org.apache.thrift.meta_data.FieldMetaData("isCod", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
      tmpMap.put(_Fields.PREFIX, new org.apache.thrift.meta_data.FieldMetaData("prefix", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(createCoupon_args.class, metaDataMap);
    }

    public createCoupon_args() {
    }

    public createCoupon_args(
      long promotionId,
      long couponCategory,
      String couponCode,
      String arguments,
      boolean isCod,
      String prefix)
    {
      this();
      this.promotionId = promotionId;
      setPromotionIdIsSet(true);
      this.couponCategory = couponCategory;
      setCouponCategoryIsSet(true);
      this.couponCode = couponCode;
      this.arguments = arguments;
      this.isCod = isCod;
      setIsCodIsSet(true);
      this.prefix = prefix;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public createCoupon_args(createCoupon_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.promotionId = other.promotionId;
      this.couponCategory = other.couponCategory;
      if (other.isSetCouponCode()) {
        this.couponCode = other.couponCode;
      }
      if (other.isSetArguments()) {
        this.arguments = other.arguments;
      }
      this.isCod = other.isCod;
      if (other.isSetPrefix()) {
        this.prefix = other.prefix;
      }
    }

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

    @Override
    public void clear() {
      setPromotionIdIsSet(false);
      this.promotionId = 0;
      setCouponCategoryIsSet(false);
      this.couponCategory = 0;
      this.couponCode = null;
      this.arguments = null;
      setIsCodIsSet(false);
      this.isCod = false;
      this.prefix = null;
    }

    public long getPromotionId() {
      return this.promotionId;
    }

    public void setPromotionId(long promotionId) {
      this.promotionId = promotionId;
      setPromotionIdIsSet(true);
    }

    public void unsetPromotionId() {
      __isset_bit_vector.clear(__PROMOTIONID_ISSET_ID);
    }

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

    public void setPromotionIdIsSet(boolean value) {
      __isset_bit_vector.set(__PROMOTIONID_ISSET_ID, value);
    }

    public long getCouponCategory() {
      return this.couponCategory;
    }

    public void setCouponCategory(long couponCategory) {
      this.couponCategory = couponCategory;
      setCouponCategoryIsSet(true);
    }

    public void unsetCouponCategory() {
      __isset_bit_vector.clear(__COUPONCATEGORY_ISSET_ID);
    }

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

    public void setCouponCategoryIsSet(boolean value) {
      __isset_bit_vector.set(__COUPONCATEGORY_ISSET_ID, value);
    }

    public String getCouponCode() {
      return this.couponCode;
    }

    public void setCouponCode(String couponCode) {
      this.couponCode = couponCode;
    }

    public void unsetCouponCode() {
      this.couponCode = null;
    }

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

    public void setCouponCodeIsSet(boolean value) {
      if (!value) {
        this.couponCode = null;
      }
    }

    public String getArguments() {
      return this.arguments;
    }

    public void setArguments(String arguments) {
      this.arguments = arguments;
    }

    public void unsetArguments() {
      this.arguments = null;
    }

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

    public void setArgumentsIsSet(boolean value) {
      if (!value) {
        this.arguments = null;
      }
    }

    public boolean isIsCod() {
      return this.isCod;
    }

    public void setIsCod(boolean isCod) {
      this.isCod = isCod;
      setIsCodIsSet(true);
    }

    public void unsetIsCod() {
      __isset_bit_vector.clear(__ISCOD_ISSET_ID);
    }

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

    public void setIsCodIsSet(boolean value) {
      __isset_bit_vector.set(__ISCOD_ISSET_ID, value);
    }

    public String getPrefix() {
      return this.prefix;
    }

    public void setPrefix(String prefix) {
      this.prefix = prefix;
    }

    public void unsetPrefix() {
      this.prefix = null;
    }

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

    public void setPrefixIsSet(boolean value) {
      if (!value) {
        this.prefix = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROMOTION_ID:
        if (value == null) {
          unsetPromotionId();
        } else {
          setPromotionId((Long)value);
        }
        break;

      case COUPON_CATEGORY:
        if (value == null) {
          unsetCouponCategory();
        } else {
          setCouponCategory((Long)value);
        }
        break;

      case COUPON_CODE:
        if (value == null) {
          unsetCouponCode();
        } else {
          setCouponCode((String)value);
        }
        break;

      case ARGUMENTS:
        if (value == null) {
          unsetArguments();
        } else {
          setArguments((String)value);
        }
        break;

      case IS_COD:
        if (value == null) {
          unsetIsCod();
        } else {
          setIsCod((Boolean)value);
        }
        break;

      case PREFIX:
        if (value == null) {
          unsetPrefix();
        } else {
          setPrefix((String)value);
        }
        break;

      }
    }

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

      case COUPON_CATEGORY:
        return Long.valueOf(getCouponCategory());

      case COUPON_CODE:
        return getCouponCode();

      case ARGUMENTS:
        return getArguments();

      case IS_COD:
        return Boolean.valueOf(isIsCod());

      case PREFIX:
        return getPrefix();

      }
      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 PROMOTION_ID:
        return isSetPromotionId();
      case COUPON_CATEGORY:
        return isSetCouponCategory();
      case COUPON_CODE:
        return isSetCouponCode();
      case ARGUMENTS:
        return isSetArguments();
      case IS_COD:
        return isSetIsCod();
      case PREFIX:
        return isSetPrefix();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_promotionId = true;
      boolean that_present_promotionId = true;
      if (this_present_promotionId || that_present_promotionId) {
        if (!(this_present_promotionId && that_present_promotionId))
          return false;
        if (this.promotionId != that.promotionId)
          return false;
      }

      boolean this_present_couponCategory = true;
      boolean that_present_couponCategory = true;
      if (this_present_couponCategory || that_present_couponCategory) {
        if (!(this_present_couponCategory && that_present_couponCategory))
          return false;
        if (this.couponCategory != that.couponCategory)
          return false;
      }

      boolean this_present_couponCode = true && this.isSetCouponCode();
      boolean that_present_couponCode = true && that.isSetCouponCode();
      if (this_present_couponCode || that_present_couponCode) {
        if (!(this_present_couponCode && that_present_couponCode))
          return false;
        if (!this.couponCode.equals(that.couponCode))
          return false;
      }

      boolean this_present_arguments = true && this.isSetArguments();
      boolean that_present_arguments = true && that.isSetArguments();
      if (this_present_arguments || that_present_arguments) {
        if (!(this_present_arguments && that_present_arguments))
          return false;
        if (!this.arguments.equals(that.arguments))
          return false;
      }

      boolean this_present_isCod = true;
      boolean that_present_isCod = true;
      if (this_present_isCod || that_present_isCod) {
        if (!(this_present_isCod && that_present_isCod))
          return false;
        if (this.isCod != that.isCod)
          return false;
      }

      boolean this_present_prefix = true && this.isSetPrefix();
      boolean that_present_prefix = true && that.isSetPrefix();
      if (this_present_prefix || that_present_prefix) {
        if (!(this_present_prefix && that_present_prefix))
          return false;
        if (!this.prefix.equals(that.prefix))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPromotionId()).compareTo(typedOther.isSetPromotionId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPromotionId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionId, typedOther.promotionId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetCouponCategory()).compareTo(typedOther.isSetCouponCategory());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCouponCategory()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCategory, typedOther.couponCategory);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCouponCode()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetArguments()).compareTo(typedOther.isSetArguments());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetArguments()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.arguments, typedOther.arguments);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetIsCod()).compareTo(typedOther.isSetIsCod());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetIsCod()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isCod, typedOther.isCod);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPrefix()).compareTo(typedOther.isSetPrefix());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPrefix()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.prefix, typedOther.prefix);
        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: // PROMOTION_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.promotionId = iprot.readI64();
              setPromotionIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 2: // COUPON_CATEGORY
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.couponCategory = iprot.readI64();
              setCouponCategoryIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 3: // COUPON_CODE
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.couponCode = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 4: // ARGUMENTS
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.arguments = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 5: // IS_COD
            if (field.type == org.apache.thrift.protocol.TType.BOOL) {
              this.isCod = iprot.readBool();
              setIsCodIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 6: // PREFIX
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.prefix = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(PROMOTION_ID_FIELD_DESC);
      oprot.writeI64(this.promotionId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(COUPON_CATEGORY_FIELD_DESC);
      oprot.writeI64(this.couponCategory);
      oprot.writeFieldEnd();
      if (this.couponCode != null) {
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
        oprot.writeString(this.couponCode);
        oprot.writeFieldEnd();
      }
      if (this.arguments != null) {
        oprot.writeFieldBegin(ARGUMENTS_FIELD_DESC);
        oprot.writeString(this.arguments);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(IS_COD_FIELD_DESC);
      oprot.writeBool(this.isCod);
      oprot.writeFieldEnd();
      if (this.prefix != null) {
        oprot.writeFieldBegin(PREFIX_FIELD_DESC);
        oprot.writeString(this.prefix);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("promotionId:");
      sb.append(this.promotionId);
      first = false;
      if (!first) sb.append(", ");
      sb.append("couponCategory:");
      sb.append(this.couponCategory);
      first = false;
      if (!first) sb.append(", ");
      sb.append("couponCode:");
      if (this.couponCode == null) {
        sb.append("null");
      } else {
        sb.append(this.couponCode);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("arguments:");
      if (this.arguments == null) {
        sb.append("null");
      } else {
        sb.append(this.arguments);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("isCod:");
      sb.append(this.isCod);
      first = false;
      if (!first) sb.append(", ");
      sb.append("prefix:");
      if (this.prefix == null) {
        sb.append("null");
      } else {
        sb.append(this.prefix);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private String success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(createCoupon_result.class, metaDataMap);
    }

    public createCoupon_result() {
    }

    public createCoupon_result(
      String success,
      PromotionException pex)
    {
      this();
      this.success = success;
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public createCoupon_result(createCoupon_result other) {
      if (other.isSetSuccess()) {
        this.success = other.success;
      }
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.pex = null;
    }

    public String getSuccess() {
      return this.success;
    }

    public void setSuccess(String success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((String)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.success = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeString(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)1);

    private String couponCode; // 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 {
      COUPON_CODE((short)1, "couponCode");

      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: // COUPON_CODE
            return COUPON_CODE;
          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

    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.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getSuccessfulPaymentCountForCoupon_args.class, metaDataMap);
    }

    public getSuccessfulPaymentCountForCoupon_args() {
    }

    public getSuccessfulPaymentCountForCoupon_args(
      String couponCode)
    {
      this();
      this.couponCode = couponCode;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getSuccessfulPaymentCountForCoupon_args(getSuccessfulPaymentCountForCoupon_args other) {
      if (other.isSetCouponCode()) {
        this.couponCode = other.couponCode;
      }
    }

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

    @Override
    public void clear() {
      this.couponCode = null;
    }

    public String getCouponCode() {
      return this.couponCode;
    }

    public void setCouponCode(String couponCode) {
      this.couponCode = couponCode;
    }

    public void unsetCouponCode() {
      this.couponCode = null;
    }

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

    public void setCouponCodeIsSet(boolean value) {
      if (!value) {
        this.couponCode = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case COUPON_CODE:
        if (value == null) {
          unsetCouponCode();
        } else {
          setCouponCode((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case COUPON_CODE:
        return getCouponCode();

      }
      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 COUPON_CODE:
        return isSetCouponCode();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_couponCode = true && this.isSetCouponCode();
      boolean that_present_couponCode = true && that.isSetCouponCode();
      if (this_present_couponCode || that_present_couponCode) {
        if (!(this_present_couponCode && that_present_couponCode))
          return false;
        if (!this.couponCode.equals(that.couponCode))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCouponCode()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
        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: // COUPON_CODE
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.couponCode = iprot.readString();
            } 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.couponCode != null) {
        oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
        oprot.writeString(this.couponCode);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("couponCode:");
      if (this.couponCode == null) {
        sb.append("null");
      } else {
        sb.append(this.couponCode);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I64, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private long success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getSuccessfulPaymentCountForCoupon_result.class, metaDataMap);
    }

    public getSuccessfulPaymentCountForCoupon_result() {
    }

    public getSuccessfulPaymentCountForCoupon_result(
      long success,
      PromotionException pex)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getSuccessfulPaymentCountForCoupon_result(getSuccessfulPaymentCountForCoupon_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      setSuccessIsSet(false);
      this.success = 0;
      this.pex = null;
    }

    public long getSuccess() {
      return this.success;
    }

    public void setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Long)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

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

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.success = iprot.readI64();
              setSuccessIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeI64(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField RULE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("ruleName", org.apache.thrift.protocol.TType.STRING, (short)1);

    private String ruleName; // 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 {
      RULE_NAME((short)1, "ruleName");

      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: // RULE_NAME
            return RULE_NAME;
          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

    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.RULE_NAME, new org.apache.thrift.meta_data.FieldMetaData("ruleName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getRuleDocString_args.class, metaDataMap);
    }

    public getRuleDocString_args() {
    }

    public getRuleDocString_args(
      String ruleName)
    {
      this();
      this.ruleName = ruleName;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getRuleDocString_args(getRuleDocString_args other) {
      if (other.isSetRuleName()) {
        this.ruleName = other.ruleName;
      }
    }

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

    @Override
    public void clear() {
      this.ruleName = null;
    }

    public String getRuleName() {
      return this.ruleName;
    }

    public void setRuleName(String ruleName) {
      this.ruleName = ruleName;
    }

    public void unsetRuleName() {
      this.ruleName = null;
    }

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

    public void setRuleNameIsSet(boolean value) {
      if (!value) {
        this.ruleName = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case RULE_NAME:
        if (value == null) {
          unsetRuleName();
        } else {
          setRuleName((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case RULE_NAME:
        return getRuleName();

      }
      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 RULE_NAME:
        return isSetRuleName();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_ruleName = true && this.isSetRuleName();
      boolean that_present_ruleName = true && that.isSetRuleName();
      if (this_present_ruleName || that_present_ruleName) {
        if (!(this_present_ruleName && that_present_ruleName))
          return false;
        if (!this.ruleName.equals(that.ruleName))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetRuleName()).compareTo(typedOther.isSetRuleName());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetRuleName()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ruleName, typedOther.ruleName);
        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: // RULE_NAME
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.ruleName = iprot.readString();
            } 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.ruleName != null) {
        oprot.writeFieldBegin(RULE_NAME_FIELD_DESC);
        oprot.writeString(this.ruleName);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("ruleName:");
      if (this.ruleName == null) {
        sb.append("null");
      } else {
        sb.append(this.ruleName);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);

    private String success; // 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 {
      SUCCESS((short)0, "success");

      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 0: // SUCCESS
            return SUCCESS;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getRuleDocString_result.class, metaDataMap);
    }

    public getRuleDocString_result() {
    }

    public getRuleDocString_result(
      String success)
    {
      this();
      this.success = success;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getRuleDocString_result(getRuleDocString_result other) {
      if (other.isSetSuccess()) {
        this.success = other.success;
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
    }

    public String getSuccess() {
      return this.success;
    }

    public void setSuccess(String success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      }
      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 SUCCESS:
        return isSetSuccess();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.success = iprot.readString();
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeString(this.success);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField ITEM_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("itemIds", org.apache.thrift.protocol.TType.LIST, (short)1);

    private List<Long> itemIds; // 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 {
      ITEM_IDS((short)1, "itemIds");

      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: // ITEM_IDS
            return ITEM_IDS;
          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

    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.ITEM_IDS, new org.apache.thrift.meta_data.FieldMetaData("itemIds", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
              new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getItemDiscountMap_args.class, metaDataMap);
    }

    public getItemDiscountMap_args() {
    }

    public getItemDiscountMap_args(
      List<Long> itemIds)
    {
      this();
      this.itemIds = itemIds;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItemDiscountMap_args(getItemDiscountMap_args other) {
      if (other.isSetItemIds()) {
        List<Long> __this__itemIds = new ArrayList<Long>();
        for (Long other_element : other.itemIds) {
          __this__itemIds.add(other_element);
        }
        this.itemIds = __this__itemIds;
      }
    }

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

    @Override
    public void clear() {
      this.itemIds = null;
    }

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

    public java.util.Iterator<Long> getItemIdsIterator() {
      return (this.itemIds == null) ? null : this.itemIds.iterator();
    }

    public void addToItemIds(long elem) {
      if (this.itemIds == null) {
        this.itemIds = new ArrayList<Long>();
      }
      this.itemIds.add(elem);
    }

    public List<Long> getItemIds() {
      return this.itemIds;
    }

    public void setItemIds(List<Long> itemIds) {
      this.itemIds = itemIds;
    }

    public void unsetItemIds() {
      this.itemIds = null;
    }

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

    public void setItemIdsIsSet(boolean value) {
      if (!value) {
        this.itemIds = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ITEM_IDS:
        if (value == null) {
          unsetItemIds();
        } else {
          setItemIds((List<Long>)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ITEM_IDS:
        return getItemIds();

      }
      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 ITEM_IDS:
        return isSetItemIds();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_itemIds = true && this.isSetItemIds();
      boolean that_present_itemIds = true && that.isSetItemIds();
      if (this_present_itemIds || that_present_itemIds) {
        if (!(this_present_itemIds && that_present_itemIds))
          return false;
        if (!this.itemIds.equals(that.itemIds))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetItemIds()).compareTo(typedOther.isSetItemIds());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetItemIds()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemIds, typedOther.itemIds);
        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: // ITEM_IDS
            if (field.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list42 = iprot.readListBegin();
                this.itemIds = new ArrayList<Long>(_list42.size);
                for (int _i43 = 0; _i43 < _list42.size; ++_i43)
                {
                  long _elem44; // required
                  _elem44 = iprot.readI64();
                  this.itemIds.add(_elem44);
                }
                iprot.readListEnd();
              }
            } 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.itemIds != null) {
        oprot.writeFieldBegin(ITEM_IDS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, this.itemIds.size()));
          for (long _iter45 : this.itemIds)
          {
            oprot.writeI64(_iter45);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("itemIds:");
      if (this.itemIds == null) {
        sb.append("null");
      } else {
        sb.append(this.itemIds);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
    private static final org.apache.thrift.protocol.TField PEX_FIELD_DESC = new org.apache.thrift.protocol.TField("pex", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private List<ItemCouponDiscount> success; // required
    private PromotionException pex; // 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 {
      SUCCESS((short)0, "success"),
      PEX((short)1, "pex");

      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 0: // SUCCESS
            return SUCCESS;
          case 1: // PEX
            return PEX;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ItemCouponDiscount.class))));
      tmpMap.put(_Fields.PEX, new org.apache.thrift.meta_data.FieldMetaData("pex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getItemDiscountMap_result.class, metaDataMap);
    }

    public getItemDiscountMap_result() {
    }

    public getItemDiscountMap_result(
      List<ItemCouponDiscount> success,
      PromotionException pex)
    {
      this();
      this.success = success;
      this.pex = pex;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getItemDiscountMap_result(getItemDiscountMap_result other) {
      if (other.isSetSuccess()) {
        List<ItemCouponDiscount> __this__success = new ArrayList<ItemCouponDiscount>();
        for (ItemCouponDiscount other_element : other.success) {
          __this__success.add(new ItemCouponDiscount(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetPex()) {
        this.pex = new PromotionException(other.pex);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.pex = null;
    }

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

    public java.util.Iterator<ItemCouponDiscount> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(ItemCouponDiscount elem) {
      if (this.success == null) {
        this.success = new ArrayList<ItemCouponDiscount>();
      }
      this.success.add(elem);
    }

    public List<ItemCouponDiscount> getSuccess() {
      return this.success;
    }

    public void setSuccess(List<ItemCouponDiscount> success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PromotionException getPex() {
      return this.pex;
    }

    public void setPex(PromotionException pex) {
      this.pex = pex;
    }

    public void unsetPex() {
      this.pex = null;
    }

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

    public void setPexIsSet(boolean value) {
      if (!value) {
        this.pex = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<ItemCouponDiscount>)value);
        }
        break;

      case PEX:
        if (value == null) {
          unsetPex();
        } else {
          setPex((PromotionException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PEX:
        return getPex();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PEX:
        return isSetPex();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pex = true && this.isSetPex();
      boolean that_present_pex = true && that.isSetPex();
      if (this_present_pex || that_present_pex) {
        if (!(this_present_pex && that_present_pex))
          return false;
        if (!this.pex.equals(that.pex))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPex()).compareTo(typedOther.isSetPex());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPex()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pex, typedOther.pex);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list46 = iprot.readListBegin();
                this.success = new ArrayList<ItemCouponDiscount>(_list46.size);
                for (int _i47 = 0; _i47 < _list46.size; ++_i47)
                {
                  ItemCouponDiscount _elem48; // required
                  _elem48 = new ItemCouponDiscount();
                  _elem48.read(iprot);
                  this.success.add(_elem48);
                }
                iprot.readListEnd();
              }
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 1: // PEX
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.pex = new PromotionException();
              this.pex.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
          for (ItemCouponDiscount _iter49 : this.success)
          {
            _iter49.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetPex()) {
        oprot.writeFieldBegin(PEX_FIELD_DESC);
        this.pex.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pex:");
      if (this.pex == null) {
        sb.append("null");
      } else {
        sb.append(this.pex);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField ENTITY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("entityId", org.apache.thrift.protocol.TType.I64, (short)1);

    private long entityId; // 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 {
      ENTITY_ID((short)1, "entityId");

      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: // ENTITY_ID
            return ENTITY_ID;
          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 __ENTITYID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.ENTITY_ID, new org.apache.thrift.meta_data.FieldMetaData("entityId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getDiscountsForEntity_args.class, metaDataMap);
    }

    public getDiscountsForEntity_args() {
    }

    public getDiscountsForEntity_args(
      long entityId)
    {
      this();
      this.entityId = entityId;
      setEntityIdIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getDiscountsForEntity_args(getDiscountsForEntity_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.entityId = other.entityId;
    }

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

    @Override
    public void clear() {
      setEntityIdIsSet(false);
      this.entityId = 0;
    }

    public long getEntityId() {
      return this.entityId;
    }

    public void setEntityId(long entityId) {
      this.entityId = entityId;
      setEntityIdIsSet(true);
    }

    public void unsetEntityId() {
      __isset_bit_vector.clear(__ENTITYID_ISSET_ID);
    }

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

    public void setEntityIdIsSet(boolean value) {
      __isset_bit_vector.set(__ENTITYID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ENTITY_ID:
        if (value == null) {
          unsetEntityId();
        } else {
          setEntityId((Long)value);
        }
        break;

      }
    }

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

      }
      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 ENTITY_ID:
        return isSetEntityId();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_entityId = true;
      boolean that_present_entityId = true;
      if (this_present_entityId || that_present_entityId) {
        if (!(this_present_entityId && that_present_entityId))
          return false;
        if (this.entityId != that.entityId)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetEntityId()).compareTo(typedOther.isSetEntityId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEntityId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.entityId, typedOther.entityId);
        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: // ENTITY_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.entityId = iprot.readI64();
              setEntityIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ENTITY_ID_FIELD_DESC);
      oprot.writeI64(this.entityId);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("entityId:");
      sb.append(this.entityId);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.MAP, (short)0);

    private Map<String,Double> success; // 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 {
      SUCCESS((short)0, "success");

      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 0: // SUCCESS
            return SUCCESS;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
              new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
              new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getDiscountsForEntity_result.class, metaDataMap);
    }

    public getDiscountsForEntity_result() {
    }

    public getDiscountsForEntity_result(
      Map<String,Double> success)
    {
      this();
      this.success = success;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getDiscountsForEntity_result(getDiscountsForEntity_result other) {
      if (other.isSetSuccess()) {
        Map<String,Double> __this__success = new HashMap<String,Double>();
        for (Map.Entry<String, Double> other_element : other.success.entrySet()) {

          String other_element_key = other_element.getKey();
          Double other_element_value = other_element.getValue();

          String __this__success_copy_key = other_element_key;

          Double __this__success_copy_value = other_element_value;

          __this__success.put(__this__success_copy_key, __this__success_copy_value);
        }
        this.success = __this__success;
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
    }

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

    public void putToSuccess(String key, double val) {
      if (this.success == null) {
        this.success = new HashMap<String,Double>();
      }
      this.success.put(key, val);
    }

    public Map<String,Double> getSuccess() {
      return this.success;
    }

    public void setSuccess(Map<String,Double> success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Map<String,Double>)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      }
      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 SUCCESS:
        return isSetSuccess();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map50 = iprot.readMapBegin();
                this.success = new HashMap<String,Double>(2*_map50.size);
                for (int _i51 = 0; _i51 < _map50.size; ++_i51)
                {
                  String _key52; // required
                  double _val53; // required
                  _key52 = iprot.readString();
                  _val53 = iprot.readDouble();
                  this.success.put(_key52, _val53);
                }
                iprot.readMapEnd();
              }
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.DOUBLE, this.success.size()));
          for (Map.Entry<String, Double> _iter54 : this.success.entrySet())
          {
            oprot.writeString(_iter54.getKey());
            oprot.writeDouble(_iter54.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField VOUCHER_FIELD_DESC = new org.apache.thrift.protocol.TField("voucher", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private Voucher voucher; // 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 {
      VOUCHER((short)1, "voucher");

      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: // VOUCHER
            return VOUCHER;
          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

    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.VOUCHER, new org.apache.thrift.meta_data.FieldMetaData("voucher", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Voucher.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(addVoucher_args.class, metaDataMap);
    }

    public addVoucher_args() {
    }

    public addVoucher_args(
      Voucher voucher)
    {
      this();
      this.voucher = voucher;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public addVoucher_args(addVoucher_args other) {
      if (other.isSetVoucher()) {
        this.voucher = new Voucher(other.voucher);
      }
    }

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

    @Override
    public void clear() {
      this.voucher = null;
    }

    public Voucher getVoucher() {
      return this.voucher;
    }

    public void setVoucher(Voucher voucher) {
      this.voucher = voucher;
    }

    public void unsetVoucher() {
      this.voucher = null;
    }

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

    public void setVoucherIsSet(boolean value) {
      if (!value) {
        this.voucher = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case VOUCHER:
        if (value == null) {
          unsetVoucher();
        } else {
          setVoucher((Voucher)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case VOUCHER:
        return getVoucher();

      }
      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 VOUCHER:
        return isSetVoucher();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_voucher = true && this.isSetVoucher();
      boolean that_present_voucher = true && that.isSetVoucher();
      if (this_present_voucher || that_present_voucher) {
        if (!(this_present_voucher && that_present_voucher))
          return false;
        if (!this.voucher.equals(that.voucher))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetVoucher()).compareTo(typedOther.isSetVoucher());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetVoucher()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.voucher, typedOther.voucher);
        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: // VOUCHER
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.voucher = new Voucher();
              this.voucher.read(iprot);
            } 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.voucher != null) {
        oprot.writeFieldBegin(VOUCHER_FIELD_DESC);
        this.voucher.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("voucher:");
      if (this.voucher == null) {
        sb.append("null");
      } else {
        sb.append(this.voucher);
      }
      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 {
        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);
      }
    }

  }

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



    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
;

      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) {
          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;
      }
    }
    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);
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(addVoucher_result.class, metaDataMap);
    }

    public addVoucher_result() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public addVoucher_result(addVoucher_result other) {
    }

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

    @Override
    public void clear() {
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      }
      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) {
      }
      throw new IllegalStateException();
    }

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

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

      return true;
    }

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

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

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

      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) {
          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 {
      oprot.writeStructBegin(STRUCT_DESC);

      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

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

  }

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

    private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.I64, (short)1);
    private static final org.apache.thrift.protocol.TField USER_EMAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("userEmail", org.apache.thrift.protocol.TType.STRING, (short)2);
    private static final org.apache.thrift.protocol.TField VOUCHER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("voucherType", org.apache.thrift.protocol.TType.I32, (short)3);
    private static final org.apache.thrift.protocol.TField AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("amount", org.apache.thrift.protocol.TType.I64, (short)4);

    private long userId; // required
    private String userEmail; // required
    private VoucherType voucherType; // required
    private long amount; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      USER_ID((short)1, "userId"),
      USER_EMAIL((short)2, "userEmail"),
      /**
       * 
       * @see VoucherType
       */
      VOUCHER_TYPE((short)3, "voucherType"),
      AMOUNT((short)4, "amount");

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

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

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // USER_ID
            return USER_ID;
          case 2: // USER_EMAIL
            return USER_EMAIL;
          case 3: // VOUCHER_TYPE
            return VOUCHER_TYPE;
          case 4: // AMOUNT
            return AMOUNT;
          default:
            return null;
        }
      }

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

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

      private final short _thriftId;
      private final String _fieldName;

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

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    private static final int __USERID_ISSET_ID = 0;
    private static final int __AMOUNT_ISSET_ID = 1;
    private BitSet __isset_bit_vector = new BitSet(2);

    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.USER_EMAIL, new org.apache.thrift.meta_data.FieldMetaData("userEmail", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.VOUCHER_TYPE, new org.apache.thrift.meta_data.FieldMetaData("voucherType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, VoucherType.class)));
      tmpMap.put(_Fields.AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("amount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(assignVoucher_args.class, metaDataMap);
    }

    public assignVoucher_args() {
    }

    public assignVoucher_args(
      long userId,
      String userEmail,
      VoucherType voucherType,
      long amount)
    {
      this();
      this.userId = userId;
      setUserIdIsSet(true);
      this.userEmail = userEmail;
      this.voucherType = voucherType;
      this.amount = amount;
      setAmountIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public assignVoucher_args(assignVoucher_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.userId = other.userId;
      if (other.isSetUserEmail()) {
        this.userEmail = other.userEmail;
      }
      if (other.isSetVoucherType()) {
        this.voucherType = other.voucherType;
      }
      this.amount = other.amount;
    }

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

    @Override
    public void clear() {
      setUserIdIsSet(false);
      this.userId = 0;
      this.userEmail = null;
      this.voucherType = null;
      setAmountIsSet(false);
      this.amount = 0;
    }

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

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

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

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

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

    public String getUserEmail() {
      return this.userEmail;
    }

    public void setUserEmail(String userEmail) {
      this.userEmail = userEmail;
    }

    public void unsetUserEmail() {
      this.userEmail = null;
    }

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

    public void setUserEmailIsSet(boolean value) {
      if (!value) {
        this.userEmail = null;
      }
    }

    /**
     * 
     * @see VoucherType
     */
    public VoucherType getVoucherType() {
      return this.voucherType;
    }

    /**
     * 
     * @see VoucherType
     */
    public void setVoucherType(VoucherType voucherType) {
      this.voucherType = voucherType;
    }

    public void unsetVoucherType() {
      this.voucherType = null;
    }

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

    public void setVoucherTypeIsSet(boolean value) {
      if (!value) {
        this.voucherType = null;
      }
    }

    public long getAmount() {
      return this.amount;
    }

    public void setAmount(long amount) {
      this.amount = amount;
      setAmountIsSet(true);
    }

    public void unsetAmount() {
      __isset_bit_vector.clear(__AMOUNT_ISSET_ID);
    }

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

    public void setAmountIsSet(boolean value) {
      __isset_bit_vector.set(__AMOUNT_ISSET_ID, value);
    }

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

      case USER_EMAIL:
        if (value == null) {
          unsetUserEmail();
        } else {
          setUserEmail((String)value);
        }
        break;

      case VOUCHER_TYPE:
        if (value == null) {
          unsetVoucherType();
        } else {
          setVoucherType((VoucherType)value);
        }
        break;

      case AMOUNT:
        if (value == null) {
          unsetAmount();
        } else {
          setAmount((Long)value);
        }
        break;

      }
    }

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

      case USER_EMAIL:
        return getUserEmail();

      case VOUCHER_TYPE:
        return getVoucherType();

      case AMOUNT:
        return Long.valueOf(getAmount());

      }
      throw new IllegalStateException();
    }

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

      switch (field) {
      case USER_ID:
        return isSetUserId();
      case USER_EMAIL:
        return isSetUserEmail();
      case VOUCHER_TYPE:
        return isSetVoucherType();
      case AMOUNT:
        return isSetAmount();
      }
      throw new IllegalStateException();
    }

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

    public boolean equals(assignVoucher_args 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_userEmail = true && this.isSetUserEmail();
      boolean that_present_userEmail = true && that.isSetUserEmail();
      if (this_present_userEmail || that_present_userEmail) {
        if (!(this_present_userEmail && that_present_userEmail))
          return false;
        if (!this.userEmail.equals(that.userEmail))
          return false;
      }

      boolean this_present_voucherType = true && this.isSetVoucherType();
      boolean that_present_voucherType = true && that.isSetVoucherType();
      if (this_present_voucherType || that_present_voucherType) {
        if (!(this_present_voucherType && that_present_voucherType))
          return false;
        if (!this.voucherType.equals(that.voucherType))
          return false;
      }

      boolean this_present_amount = true;
      boolean that_present_amount = true;
      if (this_present_amount || that_present_amount) {
        if (!(this_present_amount && that_present_amount))
          return false;
        if (this.amount != that.amount)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetUserEmail()).compareTo(typedOther.isSetUserEmail());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserEmail()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userEmail, typedOther.userEmail);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetVoucherType()).compareTo(typedOther.isSetVoucherType());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetVoucherType()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.voucherType, typedOther.voucherType);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetAmount()).compareTo(typedOther.isSetAmount());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetAmount()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.amount, typedOther.amount);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

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

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField field;
      iprot.readStructBegin();
      while (true)
      {
        field = iprot.readFieldBegin();
        if (field.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (field.id) {
          case 1: // USER_ID
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.userId = iprot.readI64();
              setUserIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 2: // USER_EMAIL
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.userEmail = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 3: // VOUCHER_TYPE
            if (field.type == org.apache.thrift.protocol.TType.I32) {
              this.voucherType = VoucherType.findByValue(iprot.readI32());
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 4: // AMOUNT
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.amount = iprot.readI64();
              setAmountIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(USER_ID_FIELD_DESC);
      oprot.writeI64(this.userId);
      oprot.writeFieldEnd();
      if (this.userEmail != null) {
        oprot.writeFieldBegin(USER_EMAIL_FIELD_DESC);
        oprot.writeString(this.userEmail);
        oprot.writeFieldEnd();
      }
      if (this.voucherType != null) {
        oprot.writeFieldBegin(VOUCHER_TYPE_FIELD_DESC);
        oprot.writeI32(this.voucherType.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
      oprot.writeI64(this.amount);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("userId:");
      sb.append(this.userId);
      first = false;
      if (!first) sb.append(", ");
      sb.append("userEmail:");
      if (this.userEmail == null) {
        sb.append("null");
      } else {
        sb.append(this.userEmail);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("voucherType:");
      if (this.voucherType == null) {
        sb.append("null");
      } else {
        sb.append(this.voucherType);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("amount:");
      sb.append(this.amount);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);

    private Voucher success; // 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 {
      SUCCESS((short)0, "success");

      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 0: // SUCCESS
            return SUCCESS;
          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

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Voucher.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(assignVoucher_result.class, metaDataMap);
    }

    public assignVoucher_result() {
    }

    public assignVoucher_result(
      Voucher success)
    {
      this();
      this.success = success;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public assignVoucher_result(assignVoucher_result other) {
      if (other.isSetSuccess()) {
        this.success = new Voucher(other.success);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
    }

    public Voucher getSuccess() {
      return this.success;
    }

    public void setSuccess(Voucher success) {
      this.success = success;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Voucher)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      }
      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 SUCCESS:
        return isSetSuccess();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
              this.success = new Voucher();
              this.success.read(iprot);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        this.success.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      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 {
        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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField VOUCHER_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("voucherCode", org.apache.thrift.protocol.TType.STRING, (short)1);
    private static final org.apache.thrift.protocol.TField REDEEMED_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("redeemedOn", org.apache.thrift.protocol.TType.I64, (short)2);

    private String voucherCode; // required
    private long redeemedOn; // 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 {
      VOUCHER_CODE((short)1, "voucherCode"),
      REDEEMED_ON((short)2, "redeemedOn");

      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: // VOUCHER_CODE
            return VOUCHER_CODE;
          case 2: // REDEEMED_ON
            return REDEEMED_ON;
          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 __REDEEMEDON_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.VOUCHER_CODE, new org.apache.thrift.meta_data.FieldMetaData("voucherCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.REDEEMED_ON, new org.apache.thrift.meta_data.FieldMetaData("redeemedOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(markVoucherAsRedeemed_args.class, metaDataMap);
    }

    public markVoucherAsRedeemed_args() {
    }

    public markVoucherAsRedeemed_args(
      String voucherCode,
      long redeemedOn)
    {
      this();
      this.voucherCode = voucherCode;
      this.redeemedOn = redeemedOn;
      setRedeemedOnIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public markVoucherAsRedeemed_args(markVoucherAsRedeemed_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      if (other.isSetVoucherCode()) {
        this.voucherCode = other.voucherCode;
      }
      this.redeemedOn = other.redeemedOn;
    }

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

    @Override
    public void clear() {
      this.voucherCode = null;
      setRedeemedOnIsSet(false);
      this.redeemedOn = 0;
    }

    public String getVoucherCode() {
      return this.voucherCode;
    }

    public void setVoucherCode(String voucherCode) {
      this.voucherCode = voucherCode;
    }

    public void unsetVoucherCode() {
      this.voucherCode = null;
    }

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

    public void setVoucherCodeIsSet(boolean value) {
      if (!value) {
        this.voucherCode = null;
      }
    }

    public long getRedeemedOn() {
      return this.redeemedOn;
    }

    public void setRedeemedOn(long redeemedOn) {
      this.redeemedOn = redeemedOn;
      setRedeemedOnIsSet(true);
    }

    public void unsetRedeemedOn() {
      __isset_bit_vector.clear(__REDEEMEDON_ISSET_ID);
    }

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

    public void setRedeemedOnIsSet(boolean value) {
      __isset_bit_vector.set(__REDEEMEDON_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case VOUCHER_CODE:
        if (value == null) {
          unsetVoucherCode();
        } else {
          setVoucherCode((String)value);
        }
        break;

      case REDEEMED_ON:
        if (value == null) {
          unsetRedeemedOn();
        } else {
          setRedeemedOn((Long)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case VOUCHER_CODE:
        return getVoucherCode();

      case REDEEMED_ON:
        return Long.valueOf(getRedeemedOn());

      }
      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 VOUCHER_CODE:
        return isSetVoucherCode();
      case REDEEMED_ON:
        return isSetRedeemedOn();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_voucherCode = true && this.isSetVoucherCode();
      boolean that_present_voucherCode = true && that.isSetVoucherCode();
      if (this_present_voucherCode || that_present_voucherCode) {
        if (!(this_present_voucherCode && that_present_voucherCode))
          return false;
        if (!this.voucherCode.equals(that.voucherCode))
          return false;
      }

      boolean this_present_redeemedOn = true;
      boolean that_present_redeemedOn = true;
      if (this_present_redeemedOn || that_present_redeemedOn) {
        if (!(this_present_redeemedOn && that_present_redeemedOn))
          return false;
        if (this.redeemedOn != that.redeemedOn)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetVoucherCode()).compareTo(typedOther.isSetVoucherCode());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetVoucherCode()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.voucherCode, typedOther.voucherCode);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetRedeemedOn()).compareTo(typedOther.isSetRedeemedOn());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetRedeemedOn()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.redeemedOn, typedOther.redeemedOn);
        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: // VOUCHER_CODE
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
              this.voucherCode = iprot.readString();
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case 2: // REDEEMED_ON
            if (field.type == org.apache.thrift.protocol.TType.I64) {
              this.redeemedOn = iprot.readI64();
              setRedeemedOnIsSet(true);
            } 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.voucherCode != null) {
        oprot.writeFieldBegin(VOUCHER_CODE_FIELD_DESC);
        oprot.writeString(this.voucherCode);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(REDEEMED_ON_FIELD_DESC);
      oprot.writeI64(this.redeemedOn);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("voucherCode:");
      if (this.voucherCode == null) {
        sb.append("null");
      } else {
        sb.append(this.voucherCode);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("redeemedOn:");
      sb.append(this.redeemedOn);
      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);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);

    private boolean success; // 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 {
      SUCCESS((short)0, "success");

      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 0: // SUCCESS
            return SUCCESS;
          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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(markVoucherAsRedeemed_result.class, metaDataMap);
    }

    public markVoucherAsRedeemed_result() {
    }

    public markVoucherAsRedeemed_result(
      boolean success)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public markVoucherAsRedeemed_result(markVoucherAsRedeemed_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
    }

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

    @Override
    public void clear() {
      setSuccessIsSet(false);
      this.success = false;
    }

    public boolean isSuccess() {
      return this.success;
    }

    public void setSuccess(boolean success) {
      this.success = success;
      setSuccessIsSet(true);
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Boolean)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return Boolean.valueOf(isSuccess());

      }
      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 SUCCESS:
        return isSetSuccess();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
        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 0: // SUCCESS
            if (field.type == org.apache.thrift.protocol.TType.BOOL) {
              this.success = iprot.readBool();
              setSuccessIsSet(true);
            } 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 {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeBool(this.success);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      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 {
        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);
      }
    }

  }

}