package com.jeesharp.business.modules.member.dto;

import com.jeesharp.framework.pojo.dto.BaseSaveDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 积分规则保存 DTO（含等级差异明细）。
 *
 * @author jeesharp
 * @since 2026-06-23
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "积分规则保存请求")
public class MemberPointsRuleSaveDTO extends BaseSaveDTO {

    @NotBlank(message = "场景编码不能为空")
    @Schema(description = "场景编码", required = true)
    private String sceneCode;

    @NotBlank(message = "规则名称不能为空")
    @Schema(description = "规则名称", required = true)
    private String ruleName;

    @NotBlank(message = "计算方式不能为空")
    @Schema(description = "计算方式", required = true)
    private String calcType;

    @Schema(description = "基础固定分")
    private Integer basePoints;

    @Schema(description = "每元积分")
    private BigDecimal amountRate;

    @NotNull(message = "是否乘以等级倍率不能为空")
    @Schema(description = "是否乘以等级倍率：0-否 1-是", required = true)
    private Integer applyLevelRate;

    @Schema(description = "积分有效天数（0=永久）")
    private Integer validDays;

    @Schema(description = "每日上限次数（0=不限）")
    private Integer dailyLimit;

    @Schema(description = "累计上限次数（0=不限）")
    private Integer totalLimit;

    @NotNull(message = "状态不能为空")
    @Schema(description = "状态：0-禁用 1-启用", required = true)
    private Integer status;

    @Schema(description = "备注")
    private String remarks;

    @Valid
    @Schema(description = "等级差异配置")
    private List<MemberPointsRuleLevelSaveItemDTO> levelItems = new ArrayList<>();
}
