package com.backendsys.entity.System;

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

@Data
public class SysMenuDTO {
  public static interface Create{}
  public static interface Update{}
  public static interface Delete{}

  private Long id;
  @NotNull(message="menu_id 不能为空", groups = { SysMenuDTO.Update.class, SysMenuDTO.Delete.class})
  private Long menu_id;
  private Long parent_id;

  @NotEmpty(message="标题不能为空", groups = { SysMenuDTO.Create.class, SysMenuDTO.Update.class })
  @Size(min = 2, max = 100, message = "标题长度在 {min}-{max} 字符", groups = { SysMenuDTO.Create.class, SysMenuDTO.Update.class })
  private String title;

  @NotEmpty(message="标题 (英文) 不能为空", groups = { SysMenuDTO.Create.class, SysMenuDTO.Update.class })
  @Size(min = 2, max = 100, message = "标题(英文)长度在 {min}-{max} 字符", groups = { SysMenuDTO.Create.class, SysMenuDTO.Update.class })
  private String title_en;

  @NotEmpty(message="链接不能为空", groups = { SysMenuDTO.Create.class, SysMenuDTO.Update.class })
  @Size(max = 1000, message = "链接长度不超过 {max} 字符", groups = { SysUserRoleDTO.Create.class, SysUserRoleDTO.Update.class })
  private String path;

  // @NotEmpty(message="组件路径不能为空", groups = { SysMenuDTO.Create.class, SysMenuDTO.Update.class })
  @Size(max = 255, message = "组件路径长度不超过 {max} 字符", groups = { SysUserRoleDTO.Create.class, SysUserRoleDTO.Update.class })
  private String component;

  @NotEmpty(message="路由元信息不能为空", groups = { SysMenuDTO.Create.class, SysMenuDTO.Update.class })
  @Size(max = 255, message = "路由元信息长度不超过 {max} 字符", groups = { SysUserRoleDTO.Create.class, SysUserRoleDTO.Update.class })
  private String meta;

  private String icon;
  private String permission;

  @Range(min = 1, max = 9999, message = "排序必须在 {min} 到 {max} 之间")
  private Integer sort;

  @RangeArray(message="状态取值有误，范围应是(-1禁用, 1启用)", value = {"-1", "1"}, groups = {SysMenuDTO.Create.class, SysMenuDTO.Update.class})
  private Integer status;
}
