using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace HoneyBox.Admin.Entities;

/// <summary>
/// 权限
/// </summary>
[Table("permissions")]
public class Permission
{
    /// <summary>
    /// 主键ID
    /// </summary>
    [Key]
    public long Id { get; set; }

    /// <summary>
    /// 权限名称
    /// </summary>
    [Required]
    [MaxLength(100)]
    public string Name { get; set; } = null!;

    /// <summary>
    /// 权限编码
    /// </summary>
    [Required]
    [MaxLength(100)]
    public string Code { get; set; } = null!;

    /// <summary>
    /// 所属模块
    /// </summary>
    [MaxLength(50)]
    public string? Module { get; set; }

    /// <summary>
    /// 权限描述
    /// </summary>
    [MaxLength(500)]
    public string? Description { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreatedAt { get; set; } = DateTime.Now;

    // 导航属性
    /// <summary>
    /// 角色权限关联
    /// </summary>
    public virtual ICollection<RolePermission> RolePermissions { get; set; } = new List<RolePermission>();
}
