package com.slodon.b2b2c.vo.promotion;

import com.slodon.b2b2c.promotion.pojo.DrawRecord;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

import static com.slodon.b2b2c.vo.promotion.DrawPrizeVO.dealPrizeTypeValue;
import static com.slodon.b2b2c.vo.promotion.DrawRecordVO.dealIsPrizeValue;
import static com.slodon.b2b2c.vo.promotion.DrawRecordVO.dealMemberNameHide;

/**
 * 封装抽奖记录vo
 */
@Data
public class DrawRecordDetailVO implements Serializable {

    private static final long serialVersionUID = 3337489762705989713L;
    @ApiModelProperty("抽奖记录id")
    private Integer recordId;

    @ApiModelProperty("抽奖活动id")
    private Integer drawId;

    @ApiModelProperty("奖项id")
    private Integer prizeId;

    @ApiModelProperty("奖项名称")
    private String prizeName;

    @ApiModelProperty("会员id")
    private Integer memberId;

    @ApiModelProperty("会员名称")
    private String memberName;

    @ApiModelProperty("会员名称(隐私处理)")
    private String memberNameHide;

    @ApiModelProperty("是否中奖，0-未中奖，1-中奖")
    private Integer isPrize;

    @ApiModelProperty("是否中奖，0-未中奖，1-中奖")
    private String isPrizeValue;

    @ApiModelProperty("抽奖时间")
    private Date recordTime;

    @ApiModelProperty("抽奖消耗积分数")
    private Integer useIntegral;

    @ApiModelProperty("奖品类型，1-积分，2-优惠券，中奖必填")
    private Integer prizeType;

    @ApiModelProperty("奖品类型，1-积分，2-优惠券，中奖必填")
    private String prizeTypeValue;

    @ApiModelProperty("奖励描述（未中奖、xx积分、xxx优惠券*n）")
    private String description;

    @ApiModelProperty("奖励优惠券id")
    private Integer couponId;

    public DrawRecordDetailVO(DrawRecord drawRecord) {
        recordId = drawRecord.getRecordId();
        drawId = drawRecord.getDrawId();
        prizeId = drawRecord.getRecordId();
        prizeName = drawRecord.getPrizeName();
        memberId = drawRecord.getMemberId();
        memberName = drawRecord.getMemberName();
        memberNameHide = dealMemberNameHide(drawRecord.getMemberName());
        isPrize = drawRecord.getIsPrize();
        isPrizeValue = dealIsPrizeValue(drawRecord.getIsPrize());
        recordTime = drawRecord.getRecordTime();
        useIntegral = drawRecord.getUseIntegral();
        prizeType = drawRecord.getPrizeType();
        prizeTypeValue = dealPrizeTypeValue(drawRecord.getPrizeType());
        description = drawRecord.getDescription();
    }

}