| | | 1 | | using System.ComponentModel.DataAnnotations; |
| | | 2 | | using ArturRios.Data.Relational.Core.Entities; |
| | | 3 | | |
| | | 4 | | namespace ArturRios.Heimdall.Domain.Entities; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// A named permission level referenced by a <see cref="Person" /> via its <c>RoleId</c>. |
| | | 8 | | /// The name is one of <c>User</c>, <c>ScopeAdmin</c>, or <c>SystemAdmin</c>. |
| | | 9 | | /// </summary> |
| | | 10 | | public class Role : Entity<long> |
| | | 11 | | { |
| | | 12 | | /// <summary> |
| | | 13 | | /// External identifier, generated on creation and used everywhere the role is addressed |
| | | 14 | | /// from outside the database. The internal <see cref="Entity{TKey}.Id" /> is never exposed to callers. |
| | | 15 | | /// </summary> |
| | 2706 | 16 | | public Guid PublicId { get; set; } = Guid.NewGuid(); |
| | | 17 | | |
| | | 18 | | /// <summary>Role name. Required, unique — <c>User</c>, <c>ScopeAdmin</c>, or <c>SystemAdmin</c>.</summary> |
| | | 19 | | [MaxLength(200)] |
| | 5412 | 20 | | public string Name { get; set; } = string.Empty; |
| | | 21 | | |
| | | 22 | | /// <summary>Optional human-readable explanation of the role's purpose and permissions.</summary> |
| | | 23 | | [MaxLength(500)] |
| | 2706 | 24 | | public string? Description { get; set; } |
| | | 25 | | |
| | | 26 | | // Navigation properties |
| | | 27 | | |
| | | 28 | | /// <summary>Persons classified by this role.</summary> |
| | 2706 | 29 | | public ICollection<Person> Persons { get; set; } = new List<Person>(); |
| | | 30 | | } |