package com.slodon.b2b2c.vo.promotion;

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

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

import static com.slodon.b2b2c.vo.promotion.DrawVO.*;

/**
 * 封装装修抽奖活动列表vo对象
 */
@Data
public class DrawListVO implements Serializable {

    private static final long serialVersionUID = -1402546394450426925L;
    @ApiModelProperty("抽奖活动id")
    private Integer drawId;

    @ApiModelProperty("抽奖活动名称，最多6个字")
    private String drawName;

    @ApiModelProperty("活动开始时间")
    private Date startTime;

    @ApiModelProperty("活动结束时间")
    private Date endTime;

    @ApiModelProperty("抽奖活动类型，1-幸运抽奖，2-大转盘，3-刮刮卡，4-摇一摇，5-翻翻看")
    private Integer drawType;

    @ApiModelProperty("抽奖活动类型，1-幸运抽奖，2-大转盘，3-刮刮卡，4-摇一摇，5-翻翻看")
    private String drawTypeValue;

    @ApiModelProperty("活动状态(1-未开始;2-进行中;3-已结束)")
    private Integer state;

    @ApiModelProperty("活动状态(1-未开始;2-进行中;3-已结束)")
    private String stateValue;

    public DrawListVO(Draw draw) {
        drawId = draw.getDrawId();
        drawName = draw.getDrawName();
        startTime = draw.getStartTime();
        endTime = draw.getEndTime();
        drawType = draw.getDrawType();
        drawTypeValue = dealDrawTypeValue(draw.getDrawType());
        state = dealState(draw.getStartTime(), draw.getEndTime());
        stateValue = dealStateValue(draw.getStartTime(), draw.getEndTime());
    }

}