package com.czg.account.dto.points;

import com.alibaba.fastjson2.annotation.JSONField;
import com.czg.validator.group.DefaultGroup;
import com.czg.validator.group.InsertGroup;
import jakarta.validation.constraints.DecimalMax;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 积分基本设置
 *
 * @author Tankaikai tankaikai@aliyun.com
 * @since 1.0 2025-02-25
 */
@Data
public class PointsBasicSettingDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 店铺id
     */
    @NotNull(message = "店铺id不能为空", groups = InsertGroup.class)
    private Long shopId;
    /**
     * 开启消费赠送积分 1-开启 0-关闭
     */
    @NotNull(message = "开启消费赠送积分不能为空", groups = DefaultGroup.class)
    private Integer enableRewards;
    /**
     * 赠积分适用群体 all-全部 vip-仅会员
     */
    @NotNull(message = "赠积分适用群体不能为空", groups = DefaultGroup.class)
    private String rewardsGroup;
    /**
     * 每消费xx元赠送1积分
     */
    @NotNull(message = "每消费xx元赠送1积分不能为空", groups = DefaultGroup.class)
    private BigDecimal consumeAmount;
    /**
     * 开启下单积分抵扣 1-开启 0-关闭
     */
    @NotNull(message = "开启下单积分抵扣不能为空", groups = DefaultGroup.class)
    private Integer enableDeduction;
    /**
     * 抵扣适用群体 all-全部 vip-仅会员
     */
    @NotBlank(message = "抵扣适用群体不能为空", groups = DefaultGroup.class)
    private String deductionGroup;
    /**
     * 下单实付抵扣门槛
     */
    @NotNull(message = "下单实付抵扣门槛不能为空", groups = DefaultGroup.class)
    @DecimalMin(value = "0", inclusive = false, message = "下单实付抵扣门槛不能小于0")
    private BigDecimal minPaymentAmount;
    /**
     * 下单最高抵扣比例
     */
    @NotNull(message = "下单最高抵扣比例不能为空", groups = DefaultGroup.class)
    @DecimalMin(value = "0", inclusive = false, message = "下单最高抵扣比例不能小于等于0")
    @DecimalMax(value = "100", message = "下单最高抵扣比例不能大于100")
    private BigDecimal maxDeductionRatio;
    /**
     * 下单抵扣积分比例 1元=?积分
     */
    @NotNull(message = "下单抵扣积分比例不能为空", groups = DefaultGroup.class)
    private Integer equivalentPoints;
    /**
     * 开启积分商城
     */
    @NotNull(message = "开启积分商城不能为空", groups = DefaultGroup.class)
    private Integer enablePointsMall;
    /**
     * 浏览模式 list-列表 grid-宫格
     */
    @NotBlank(message = "浏览模式不能为空", groups = DefaultGroup.class)
    private String browseMode;
    /**
     * 创建时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

}