package com.yonge.cooleshow.student.io.request;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.yonge.cooleshow.biz.dal.enums.coupon.CouponCategoryEnum;
import com.yonge.cooleshow.biz.dal.enums.coupon.CouponUseStateEnum;
import com.yonge.toolset.base.page.QueryInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

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

/**
 * 优惠券信息
 * Created by Eric.Shang on 2022/9/2.
 */
public class CouponInfoVO {

    /**
     * 优惠券分页请求信息
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(value = "优惠券信息分页请求", description = "优惠券信息分页")
    public static class PageRequest extends QueryInfo {

        @ApiModelProperty(value = "用户id",hidden = true)
        private Long userId;

        @ApiModelProperty("客户端类型: TEACHER(老师端), STUDENT(学生端)")
        private String clientType;

        @ApiModelProperty("优惠券类型: FULL_DISCOUNT(满减券) VOUCHER(代金券) ")
        private String couponType;


        @ApiModelProperty("使用状态 USED:已使用 USABLE：未使用 EXPIRED：过期  WITHDRAW 撤回")
        private String useState;


        @ApiModelProperty("可用品类 UNIVERSAL：全场通用 VIP：小酷Ai PIANO：云酷琴房 MALL：商场购物券 MUSIC：单曲点播券 SPARRING：陪练课购买券 LIVE：直播课购买券  VIDEO：视频课购买券")
        private CouponCategoryEnum couponCategory;


        // 可用品类
        @ApiModelProperty(hidden = true)
        private List<CouponCategoryEnum> couponCategoryList;

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

    /**
     * 优惠券分页响应数据
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(value = "优惠券信息分页信息", description = "优惠券信息分页信息")
    public static class CouponPageInfo implements Serializable {

        @ApiModelProperty("优惠券发放id")
        private Long couponIssueId;

        @ApiModelProperty("优惠券名称")
        private String couponName;

        @ApiModelProperty("客户端类型: TEACHER(老师端), STUDENT(学生端)")
        private String clientType;

        @ApiModelProperty("优惠券类型: FULL_DISCOUNT(满减券) VOUCHER(代金券) ")
        private String couponType;

        @ApiModelProperty("使用门槛")
        private BigDecimal useLimit;

        @ApiModelProperty("优惠金额")
        private BigDecimal discountPrice;

        @ApiModelProperty("用户ID")
        private Long userId;

        @ApiModelProperty("优惠券ID")
        private Long couponId;

        @ApiModelProperty("使用状态: EXPIRED(已失效) USABLE(可使用) USED(已使用) ")
        private CouponUseStateEnum useState;

        @ApiModelProperty("使用时间")
        private Long useTime;

        @ApiModelProperty("生效时间")
        @JSONField(format = "yyyy-MM-dd")
        private Long startTime;

        @ApiModelProperty("失效时间")
        @JSONField(format = "yyyy-MM-dd")
        private Long endTime;


        @ApiModelProperty("可用品类 UNIVERSAL：全场通用 VIP：小酷Ai PIANO：云酷琴房 MALL：商场购物券 MUSIC：单曲点播券 SPARRING：陪练课购买券 LIVE：直播课购买券  VIDEO：视频课购买券")
        private CouponCategoryEnum couponCategory;

    }


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

        @ApiModelProperty("使用状态 USED:已使用 USABLE：未使用 EXPIRED：过期")
        private CouponUseStateEnum useState;

        @ApiModelProperty("数量统计")
        private Integer total;

    }
}
