package com.yonge.cooleshow.biz.dal.vo.coupon;

import com.alibaba.fastjson.JSON;
import com.yonge.cooleshow.biz.dal.enums.coupon.CouponUseStateEnum;
import com.yonge.cooleshow.biz.dal.enums.coupon.CouponValidTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

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

/**
 *  优惠券信息
 * Created by Eric.Shang on 2022/9/2.
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CouponInfoWrapper implements Serializable {

    private Long id;
    private String name;
    private String clientType;
    private String category;
    private String couponType;
    private Integer inventory;
    private Integer status;
    private Long updatedBy;
    private Long updateTime;
    private Long createdBy;
    private Date createdTime;

    private CouponValidTypeEnum validType;
    private Long endTime;

    // 发放领取数
    private Integer issueNum;
    // 关联奖品数
    private Integer rewardNum;
    // 更新用户
    private String updatedUser;

    public String jsonString() {
        return JSON.toJSONString(this);
    }

    public CouponInfoWrapper rewardNum(Integer rewardNum) {
        this.rewardNum = rewardNum;
        return this;
    }

    public CouponInfoWrapper updatedUser(String updateUser) {
        this.updatedUser = updateUser;
        return this;
    }

    /**
     * 优惠券状态统计
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class CouponStat implements Serializable {

        // 优惠券统计状态
        private CouponUseStateEnum useState;
        // 统计数据
        private Integer total;

    }
}
