package com.qqchen.deploy.backend.system.entity;

import com.qqchen.deploy.backend.framework.annotation.LogicDelete;
import com.qqchen.deploy.backend.framework.domain.Entity;
import jakarta.persistence.Column;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.HashSet;
import java.util.Set;


@Data
@EqualsAndHashCode(callSuper = true)
@jakarta.persistence.Entity
@Table(name = "sys_menu")
@LogicDelete
public class Menu extends Entity<Long> {
    
    /**
     * 菜单名称
     */
    @Column(nullable = false)
    private String name;
    
    /**
     * 菜单路径
     */
    private String path;
    
    /**
     * 前端组件路径
     */
    private String component;
    
    /**
     * 菜单图标
     */
    private String icon;
    
    /**
     * 权限标识
     */
    private String permission;
    
    /**
     * 菜单类型（1：目录 2：菜单 3：按钮）
     */
    @Column(nullable = false)
    private Integer type;
    
    /**
     * 父级菜单ID
     */
    private Long parentId;
    
    /**
     * 显示顺序
     */
    @Column(nullable = false)
    private Integer sort;
    
    /**
     * 是否隐藏（true：隐藏 false：显示）
     */
    private Boolean hidden;
    
    /**
     * 菜单关联的角色列表
     */
    @ManyToMany(mappedBy = "menus")
    private Set<Role> roles = new HashSet<>();
    
}