package com.czg.market.dto;

import com.czg.market.entity.ShopCoupon;
import com.czg.validator.group.UpdateGroup;
import com.czg.validator.group.member.MemberLevelCycleRewardGroup;
import jakarta.validation.constraints.*;
import lombok.Data;

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

@Data
public class MemberLevelDTO implements Serializable {
    /**
     * ID
     */
    @NotNull(message = "id不为空", groups = UpdateGroup.class)
    private Long id;

    /**
     * 说明
     */
    @Size(max = 200, message = "最大长度为200")
    private String remark;

    /**
     * 会员名称
     */
    @NotBlank(message = "会员名称不为空")
    @Size(max = 30, message = "最大长度为30")
    private String name;

    /**
     * 所需成长值
     */
    @Min(value = 0, message = "成长值不能小于0")
    @NotNull(message = "成长值不为空")
    private Integer experienceValue;

    /**
     * 会员折扣
     */
    @NotNull(message = "会员折扣不为空")
    @Min(value = 0, message = "会员折扣不能小于0")
    private Integer discount;

    /**
     * logo
     */
    private String logo;

    /**
     * 消费送积分，消费n元送1积分, 0为禁用
     */
    @DecimalMin(value = "0.01", message = "消费送积分不能小于0.01")
    private Float costRewardPoints;

    /**
     * 周期奖励状态 0禁用 1启用
     */
    @NotNull(message = "周期奖励状态不为空")
    private Integer isCycleReward;

    /**
     * 周期时间包含周 月 年 日
     */
    @NotNull(message = "周期时间不为空", groups = MemberLevelCycleRewardGroup.class)
    private Integer cycleTime;
    @NotBlank(message = "周期单位不为空", groups = MemberLevelCycleRewardGroup.class)
    private String cycleUnit;

    /**
     * 赠送积分
     */
    @DecimalMin(value = "0.01", message = "赠送积分不能小于0.01")
    private Float cycleRewardPoints;

    /**
     * 优惠券列表
     */

    private List<ConfigCoupon> cycleRewardCouponList;
    @NotNull(message = "是否启用消费送积分不为空")
    private Integer isCostRewardPoints;

    @Data
    public static class ConfigCoupon implements Serializable{
        @Min(value = 1, message = "数量不能小于1")
        private Integer num;
        private ShopCoupon coupon;
    }
}
