package com.czg.market.dto;

import com.czg.market.entity.ShopCoupon;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

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

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

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

    @Data
    public static class ConfigList implements Serializable {
        @NotBlank(message = "名称不为空")
        private String name;
        @NotNull(message = "价格不能为空")
        @DecimalMin(value = "0.01", message = "价格不能小于0.01")
        private BigDecimal price;
        @Min(value = 0, message = "赠送成长值不能小于0")
        private Integer reward;
        @Valid
        private List<ConfigCoupon> couponList;
        @NotNull(message = "会员周期不为空")
        @Min(value = 1, message = "会员周期不能小于1")
        private Integer circleTime;
        @NotBlank(message = "会员周期单位不为空")
        private String circleUnit;
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class condition implements Serializable {
        private String code;
        private String value;
    }

    /**
     * id
     */
    @NotNull(message = "id不能为空")
    private Long id;

    private Long isOpen;
    /**
     * 提交生日/姓名
     */
    @NotNull(message = "提交生日/姓名不能为空")
    private Integer isSubmitInfo;


    /**
     * 方案列表
     */
    @Valid
    private List<ConfigList> configList;

    /**
     * 条件开通条件项
     */
    @Valid
    private List<condition> conditionList;


    /**
     * 参与会员价门店
     */
    private List<Long> memberPriceShopIdList;

    /**
     * 是否享受会员价
     */
    @NotNull(message = "是否享受会员价不能为空")
    private Integer isMemberPrice;

    /**
     * 每消费一元经验值
     */
    @Min(value = 0, message = "消费增成长值最小为0")
    private Float costReward;

    /**
     * 每充值一元经验值
     */
    @Min(value = 0, message = "充值增成长值最小为0")
    private Float rechargeReward;

    /**
     * 规则说明
     */
    @NotBlank(message = "规则说明不能为空")
    private String remark;

    private String openType;

    private String memberPriceShopType;


}
