package com.erp.approval.dto;

import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 创建审核规则请求DTO
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AuditRuleCreateRequest {
    
    @NotBlank(message = "规则名称不能为空")
    @Size(max = 100, message = "规则名称最多100个字符")
    private String name;
    
    @NotBlank(message = "规则类型不能为空")
    @Pattern(regexp = "^(order|refund)$", message = "规则类型必须是order或refund")
    private String type;
    
    @NotEmpty(message = "条件配置不能为空")
    @Valid
    private List<ConditionDTO> conditions;
    
    @NotEmpty(message = "动作配置不能为空")
    @Valid
    private List<ActionDTO> actions;
    
    @Min(value = 1, message = "优先级最小为1")
    @Max(value = 9999, message = "优先级最大为9999")
    private Integer priority;
    
    private Boolean isActive;
    
    @Size(max = 500, message = "描述最多500个字符")
    private String description;
}
