using ZhonTai.Admin.Core.Entities;
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using ZhonTai.Admin.Domain.Permission;
using ZhonTai.Admin.Domain.User;
using ZhonTai.Admin.Domain.UserRole;
using ZhonTai.Admin.Domain.RolePermission;
using ZhonTai.Admin.Domain.Org;
namespace ZhonTai.Admin.Domain.Role;
///
/// 角色
///
[Table(Name = "ad_role")]
[Index("idx_{tablename}_01", $"{nameof(TenantId)},{nameof(ParentId)},{nameof(Name)}", true)]
public partial class RoleEntity : EntityBase, ITenant
{
///
/// 租户Id
///
[Column(Position = 2, CanUpdate = false)]
public long? TenantId { get; set; }
///
/// 父级Id
///
public long ParentId { get; set; }
[Navigate(nameof(ParentId))]
public List Childs { get; set; }
///
/// 名称
///
[Column(StringLength = 50)]
public string Name { get; set; }
///
/// 编码
///
[Column(StringLength = 50)]
public string Code { get; set; }
///
/// 数据范围
///
[Column(MapType = typeof(int))]
public DataScope DataScope { get; set; } = DataScope.All;
///
/// 说明
///
[Column(StringLength = 200)]
public string Description { get; set; }
///
/// 隐藏
///
public bool Hidden { get; set; }
///
/// 排序
///
public int Sort { get; set; }
///
/// 用户列表
///
[Navigate(ManyToMany = typeof(UserRoleEntity))]
public ICollection Users { get; set; }
///
/// 部门列表
///
[Navigate(ManyToMany = typeof(RoleOrgEntity))]
public ICollection Orgs { get; set; }
///
/// 权限列表
///
[Navigate(ManyToMany = typeof(RolePermissionEntity))]
public ICollection Permissions { get; set; }
}