package com.backendsys.entity.System;

import com.backendsys.entity.validator.RangeArray;
import jakarta.validation.constraints.*;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import java.util.List;

@Data
public class SysUserRoleDTO<T> {
  public static interface Detail{}
  public static interface Create{}
  public static interface Update{}
  public static interface Delete{}


  private Long id;
  @NotNull(message="role_id 不能为空", groups = { SysUserRoleDTO.Detail.class, SysUserRoleDTO.Update.class, SysUserRoleDTO.Delete.class})
  private Long role_id;
  @Size(min = 2, max = 20, message = "角色名称长度在 {min}-{max} 字符", groups = {SysUserRoleDTO.Create.class, SysUserRoleDTO.Update.class})
  private String role_name;
  @Size(max = 200, message = "角色描述长度不超过 {max} 字符", groups = {SysUserRoleDTO.Create.class, SysUserRoleDTO.Update.class})
  private String role_description;
  //@Positive(message = "排序必须为正整数")
  @Range(min = 1, max = 9999, message = "排序必须在 {min} 到 {max} 之间")
  private Integer sort;
  @RangeArray(message="状态取值有误，范围应是(-1禁用, 1启用)", value = {"-1", "1"}, groups = {SysUserRoleDTO.Create.class, SysUserRoleDTO.Update.class})
  private Integer status;
  private Integer user_count;
  @NotNull(message="角色权限不能为空", groups = {SysUserRoleDTO.Create.class, SysUserRoleDTO.Update.class})
  // private List<LinkedHashMap<String, Object>> modules;
  // 返回时，值是 对象数组：[{id,module_name}]；
  // 提交时，值是数组：['1','1.1']
  // 所以这里改用泛型
  private List<T> modules;
}
