package com.iformall.domain.vo;

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

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

@JsonIgnoreProperties(value = {"handler"})
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxCouponCVo extends WxCoupon implements Serializable  {
    private static final long serialVersionUID = 1L;

    protected Long id;

    @TableField(exist = false)
    private String salePriceStr;

    @TableField(exist = false)
    private String usePriceStr;

    @TableField(exist = false)
    private String priceStr;

    @TableField(exist = false)
    private Integer activityStatus;

    @TableField(exist = false)
    private String qrCode;


    @io.swagger.annotations.ApiModelProperty(value="券ID",name="couponId")
    private Long couponId;
    @io.swagger.annotations.ApiModelProperty(value="投放频道位置（1.列表, 2.限时抢购）",name="targetAd")
    private Integer targetAd;

    /**发放相关参数*/
    @io.swagger.annotations.ApiModelProperty(value="开始时间",name="beginTime")
    private Date beginTime;
    @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endTime")
    private Date endTime;

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

    @io.swagger.annotations.ApiModelProperty(value = "是否支持转送(0:不支持,1支持)", name = "supportTransfer")
    private Integer supportTransfer;

    @io.swagger.annotations.ApiModelProperty(value = "限制人数", name = "pressLimitNum")
    private Integer pressLimitNum;

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

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

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