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

import com.qqchen.deploy.backend.framework.domain.Entity;
import jakarta.persistence.Column;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.Table;
import lombok.Data;

import java.util.HashSet;
import java.util.Set;

/**
 * 权限模板实体
 */
@Data
@jakarta.persistence.Entity
@Table(name = "sys_permission_template")
public class PermissionTemplate extends Entity<Long> {
    
    /**
     * 模板编码
     */
    @Column(nullable = false, length = 100)
    private String code;
    
    /**
     * 模板名称
     */
    @Column(nullable = false, length = 100)
    private String name;
    
    /**
     * 模板类型（1：系统模板 2：自定义模板）
     */
    @Column(nullable = false)
    private Integer type;
    
    /**
     * 模板描述
     */
    private String description;
    
    /**
     * 是否启用
     */
    private Boolean enabled;
    
    /**
     * 模板包含的菜单列表
     */
    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(
        name = "sys_template_menu",
        joinColumns = @JoinColumn(name = "template_id"),
        inverseJoinColumns = @JoinColumn(name = "menu_id")
    )
    private Set<Menu> menus = new HashSet<>();
} 