package com.iformall.domain.vo;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.iformall.domain.po.WxCouponOrder;

import javax.persistence.Transient;
import java.util.List;

@JsonIgnoreProperties(value = {"handler"})
public class WxCardCVo extends WxCouponOrder {

	@Transient
	protected String sortColumns;

	/* 券类型信息 */
	/**封面图**/
	@io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg")
	private String coverImg;
	/**券名称**/
	@io.swagger.annotations.ApiModelProperty(value="券名称",name="title")
	private String title;
	/**副标题**/
	@io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle")
	private String subTitle;
	/**单位**/
	@io.swagger.annotations.ApiModelProperty(value="单位0:钱分，1:小时",name="unit")
	private Integer unit;
	/**须知**/
	@io.swagger.annotations.ApiModelProperty(value="须知",name="detail")
	private String detail;
	/**购买须知**/
	@io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark")
	private String remark;

	/*发券商户信息*/
	/**商户id**/
	@io.swagger.annotations.ApiModelProperty(value="商户id",name="merchantId")
	private Long merchantId;
	/**使用商户名**/
	@io.swagger.annotations.ApiModelProperty(value="商户名",name="name")
	private String merchantName;

	/**发券商户信息*/
	@io.swagger.annotations.ApiModelProperty(value="商户列表",name="merchantVoList")
	private List<WxMerchantVo> merchantVoList;

	/**卡信息*/
	/**卡面额总金额**/
	@io.swagger.annotations.ApiModelProperty(value = "卡面额总金额", name = "amount")
	private Integer amount;
	/**卡面额余额**/
	@io.swagger.annotations.ApiModelProperty(value = "卡面额余额", name = "remainingAmount")
	private Integer remainingAmount;

	/**卡消费信息*/
	@io.swagger.annotations.ApiModelProperty(value="卡消费列表",name="cardSpendList")
	private List<WxCardSpendVo> cardSpendList;

    @io.swagger.annotations.ApiModelProperty(value = "是否可转赠", name = "supportTransfer")
    private Integer supportTransfer;

	@io.swagger.annotations.ApiModelProperty(value = "couponChannelId", name = "couponChannelId")
	private Long couponChannelId;

	@Transient
	protected List<Integer> statusS;

	@Transient
	protected String statusStr;

	public List<WxMerchantVo> getMerchantVoList() {
		return merchantVoList;
	}

	public void setMerchantVoList(List<WxMerchantVo> merchantVoList) {
		this.merchantVoList = merchantVoList;
	}

	public Long  getMerchantId() {
		return merchantId;
	}
	public void setMerchantId(Long _merchantId) {
		merchantId = _merchantId;
	}
	public String  getCoverImg() {
		return coverImg;
	}
	public void setCoverImg(String _coverImg) {
		coverImg = _coverImg;
	}
	public String  getTitle() {
		return title;
	}
	public void setTitle(String _title) {
		title = _title;
	}
	public String  getSubTitle() {
		return subTitle;
	}
	public void setSubTitle(String _subTitle) {
		subTitle = _subTitle;
	}
	public String  getDetail() {
		return detail;
	}
	public void setDetail(String _detail) {
		detail = _detail;
	}
	public Integer getUnit() {
		return unit;
	}
	public void setUnit(Integer unit) {
		this.unit = unit;
	}

	public String  getRemark() {
		return remark;
	}
	public void setRemark(String _remark) {
		remark = _remark;
	}

	public String  getMerchantName() {
		return merchantName;
	}
	public void setMerchantName(String _name) {
		merchantName = _name;
	}

	public Integer getAmount() {
		return amount;
	}

	public void setAmount(Integer amount) {
		this.amount = amount;
	}

	public Integer getRemainingAmount() {
		return remainingAmount;
	}

	public void setRemainingAmount(Integer remainingAmount) {
		this.remainingAmount = remainingAmount;
	}

	public List<WxCardSpendVo> getCardSpendList() {
		return cardSpendList;
	}

	public void setCardSpendList(List<WxCardSpendVo> cardSpendList) {
		this.cardSpendList = cardSpendList;
	}

	public List<Integer> getStatusS() {
		return statusS;
	}

	public void setStatusS(List<Integer> statusS) {
		this.statusS = statusS;
	}

	public String getStatusStr() {
		return statusStr;
	}

	public void setStatusStr(String statusStr) {
		this.statusStr = statusStr;
	}

    public Integer getSupportTransfer() {
        return supportTransfer;
    }

    public void setSupportTransfer(Integer supportTransfer) {
        this.supportTransfer = supportTransfer;
    }

	public Long getCouponChannelId() {
		return couponChannelId;
	}

	public void setCouponChannelId(Long couponChannelId) {
		this.couponChannelId = couponChannelId;
	}

	public static enum Field {
		Id_ASC("co.`id` ASC"), Id_DESC("co.`id` DESC"),
		TenantId_ASC("co.`tenant_id` ASC"), TenantId_DESC("co.`tenant_id` DESC"),
		CouponId_ASC("co.`coupon_id` ASC"), CouponId_DESC("co.`coupon_id` DESC"),
		CouponType_ASC("co.`coupon_type` ASC"), CouponType_DESC("co.`coupon_type` DESC"),
		CUserId_ASC("co.`c_user_id` ASC"), CUserId_DESC("co.`c_user_id` DESC"),
		OwnerId_ASC("co.`owner_id` ASC"), OwnerId_DESC("co.`owner_id` DESC"),
		BUserId_ASC("co.`b_user_id` ASC"), BUserId_DESC("co.`b_user_id` DESC"),
		OrderId_ASC("co.`order_id` ASC"), OrderId_DESC("co.`order_id` DESC"),
		ExpiredTime_ASC("co.`expired_time` ASC"), ExpiredTime_DESC("co.`expired_time` DESC"),
		CouponOrderStatus_ASC("co.`coupon_order_status` ASC"), CouponOrderStatus_DESC("co.`coupon_order_status` DESC"),
		CreateDate_ASC("co.`create_date` ASC"), CreateDate_DESC("co.`create_date` DESC"),
		UpdateDate_ASC("co.`update_date` ASC"), UpdateDate_DESC("co.`update_date` DESC"),
		CouponPrice_ASC("co.`coupon_price` ASC"), CouponPrice_DESC("co.`coupon_price` DESC");
		private String value;

		Field(String value) {
			this.value = value;
		}

		public String getValue() {
			return value;
		}

		public void setCol(String value) {
			this.value = value;
		}

		@Override
		public String toString() {
			return this.getValue();
		}
	}

	public void setSortColumns(WxCouponOrder.Field... fields) {
		if (fields == null || fields.length == 0) {
			return;
		}
		for (int k = 0; k < fields.length; k++) {
			if (fields[k] == null) {
				return;
			}
		}
		StringBuilder sb = new StringBuilder(fields[0].toString());
		for (int k = 1; k < fields.length; k++) {
			sb.append(",");
			sb.append(fields[k].toString());
		}
		this.sortColumns = sb.toString();
		super.sortColumns = this.sortColumns;

	}

	public void setSortColumns(String sortColumns) {
		if (sortColumns == null || "".equals(sortColumns.trim())) {
			return;
		}
		if (sortColumns.contains(",")) {
			String[] cols = sortColumns.split(",");
			java.util.List<WxCouponOrder.Field> fList = new java.util.ArrayList();
			for (int k = 0; k < cols.length; k++) {
				fList.add(WxCouponOrder.Field.valueOf(cols[k]));
			}
			this.setSortColumns(fList.toArray(new WxCouponOrder.Field[fList.size()]));
		} else {
			this.setSortColumns(WxCouponOrder.Field.valueOf(sortColumns));
		}
	}
}
