package com.liquidnet.service.sweet.dto.vo.admin;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.sweet.entity.SweetIntegralActivity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * SweetIntegralActivityVo
 * </p>
 *
 * @author jiangxiulong
 * @since 2021-10-20
 */

@Data
@ApiModel
public class SweetIntegralActivityVo implements Serializable, Cloneable {

    private static final long serialVersionUID = 1599981143175023116L;

    @ApiModelProperty(value = "活动id")
    private String integralActivityId;

    @ApiModelProperty(value = "活动名称")
    private String activityTitle;

    @ApiModelProperty(value = "活动图片")
    private String activityImg;

    @ApiModelProperty(value = "活动类型 1转盘")
    private Integer activityType;

    @ApiModelProperty(value = "活动玩一次所需积分")
    private Integer activityNum;

    @ApiModelProperty(value = "活动时间类型 1长期 2开始结束时间")
    private Integer timeType;

    @ApiModelProperty(value = "如果活动有时间限制 开始时间")
    private String startTime;

    @ApiModelProperty(value = "如果活动有时间限制 结束时间")
    private String endTime;

    @ApiModelProperty(value = "快递费用类型 1包邮 2到付")
    private Integer expressFeeType;

    @ApiModelProperty(value = "活动规则")
    private String activityRules;

    @ApiModelProperty(value = "是否上线 1未上线 2已上线")
    private Integer isOnline;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
    private LocalDateTime createdAt;

    @ApiModelProperty(value = "更新时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
    private LocalDateTime updatedAt;

    @ApiModelProperty(value = "奖品列表")
    private List<SweetIntegralActivityPrizeVo> prizeList;

    private static final SweetIntegralActivityVo obj = new SweetIntegralActivityVo();

    public static SweetIntegralActivityVo getNew() {
        try {
            return (SweetIntegralActivityVo) obj.clone();
        } catch (CloneNotSupportedException e) {
            return new SweetIntegralActivityVo();
        }
    }

    public SweetIntegralActivityVo copy(SweetIntegralActivity source) {
        if (null == source) return this;
        this.setIntegralActivityId(source.getIntegralActivityId());
        this.setActivityTitle(source.getActivityTitle());
        this.setActivityImg(source.getActivityImg());
        this.setActivityType(source.getActivityType());
        this.setActivityNum(source.getActivityNum());
        this.setTimeType(source.getTimeType());
        this.setStartTime(DateUtil.Formatter.yyyyMMddHHmmss.format(source.getStartTime()));
        this.setEndTime(DateUtil.Formatter.yyyyMMddHHmmss.format(source.getEndTime()));
        this.setExpressFeeType(source.getExpressFeeType());
        this.setActivityRules(source.getActivityRules());
        this.setIsOnline(source.getIsOnline());
        this.setCreatedAt(source.getCreatedAt());
        this.setUpdatedAt(source.getUpdatedAt());
        return this;
    }

}
