package com.erp.permission.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;

/**
 * 批量创建权限请求
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BatchCreatePermissionRequest {
    
    /**
     * 权限列表
     */
    @NotEmpty(message = "权限列表不能为空")
    @Valid
    private List<PermissionItem> permissions;
    
    /**
     * 权限项
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class PermissionItem {
        
        @NotBlank(message = "权限名称不能为空")
        @Size(max = 255, message = "权限名称不能超过255个字符")
        private String name;
        
        @NotBlank(message = "权限标识不能为空")
        @Size(max = 100, message = "权限标识不能超过100个字符")
        private String code;
        
        @NotBlank(message = "权限分组不能为空")
        @Size(max = 100, message = "权限分组不能超过100个字符")
        private String group;
        
        @Size(max = 500, message = "权限描述不能超过500个字符")
        private String description;
        
        @Min(value = 0, message = "排序最小为0")
        private Integer sort;
    }
}
