package com.iformall.domain.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.iformall.domain.po.WxCouponOrder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@JsonIgnoreProperties(value = {"handler"})
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxCouponOrderCVo extends WxCouponOrder {
    private static final long serialVersionUID = 6687954932922444531L;

	protected Long id;

	@TableField(exist = false)
	protected List<Long> ids;

	@TableField(exist = false)
	private Integer validStatus;


	/** 基础购买到的券信息 */
	@io.swagger.annotations.ApiModelProperty(value = "", name = "tenantId")
	private String tenantId;
	@io.swagger.annotations.ApiModelProperty(value = "单张券ID", name = "couponId")
	private Long couponId;
	@io.swagger.annotations.ApiModelProperty(value = "用户订单ID", name = "orderId")
	private Long orderId;
	@io.swagger.annotations.ApiModelProperty(value = "该订单对应券的实际过期时间 ", name = "expiredTime")
	private Date expiredTime;
	@io.swagger.annotations.ApiModelProperty(value = "状态：0，待使用 1，已核销 2，已过期 3，已作废 ", name = "couponOrderStatus")
	private Integer couponOrderStatus;
	@io.swagger.annotations.ApiModelProperty(value = "", name = "createDate")
	private Date createDate;
	@io.swagger.annotations.ApiModelProperty(value = "", name = "updateDate")
	private Date updateDate;
	@io.swagger.annotations.ApiModelProperty(value = "单券实际购买价格", name = "couponPrice")
	private Integer couponPrice;

	/** 券类型信息 */
	@io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type")
	private Integer type;
	@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="售价（适用于类型2，3，4，5）",name="salePrice")
	private Integer salePrice;
	@io.swagger.annotations.ApiModelProperty(value="使用条件金额（适用于类型1,2,3,4）",name="usePrice")
	private Integer usePrice;
	@io.swagger.annotations.ApiModelProperty(value="面额",name="price")
	private Integer price;
	@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;
	@io.swagger.annotations.ApiModelProperty(value="有效日期-开始",name="validStartDate")
	private Date validStartDate;
	@io.swagger.annotations.ApiModelProperty(value="有效日期-结束",name="validEndDate")
	private Date validEndDate;

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

	@io.swagger.annotations.ApiModelProperty(value="卡券来源",name="sendChannelType")
	private Integer sendChannelType;

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

	@TableField(exist = false)
	private String salePriceStr;

	@TableField(exist = false)
	private String usePriceStr;

	@TableField(exist = false)
	private String priceStr;

	public String getSalePriceStr() {
		if(salePrice!=null) {
			salePriceStr = new BigDecimal(salePrice).divide(new BigDecimal(100)).toString();
		}
		return salePriceStr;
	}

	public String getUsePriceStr() {
		if(usePrice!=null) {
			usePriceStr = new BigDecimal(usePrice).divide(new BigDecimal(100)).toString();
		}
		return usePriceStr;
	}

	public String getPriceStr() {
		if(price!=null) {
			priceStr = new BigDecimal(price).divide(new BigDecimal(100)).toString();
		}
		return priceStr;
	}
}
