using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace HoneyBox.Admin.Entities;

/// <summary>
/// 角色-权限关联表
/// </summary>
[Table("role_permissions")]
public class RolePermission
{
    /// <summary>
    /// 主键ID
    /// </summary>
    [Key]
    public long Id { get; set; }

    /// <summary>
    /// 角色ID
    /// </summary>
    public long RoleId { get; set; }

    /// <summary>
    /// 权限ID
    /// </summary>
    public long PermissionId { get; set; }

    // 导航属性
    /// <summary>
    /// 角色
    /// </summary>
    [ForeignKey("RoleId")]
    public virtual Role Role { get; set; } = null!;

    /// <summary>
    /// 权限
    /// </summary>
    [ForeignKey("PermissionId")]
    public virtual Permission Permission { get; set; } = null!;
}
