| | | 1 | | using System.ComponentModel.DataAnnotations; |
| | | 2 | | using ArturRios.Data.Relational.Core.Entities; |
| | | 3 | | |
| | | 4 | | namespace ArturRios.Heimdall.Domain.Entities; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// A registered non-human identity representing another system. Belongs to exactly one |
| | | 8 | | /// <see cref="Scope" /> and is owned by exactly one <see cref="Person" /> — an existing, |
| | | 9 | | /// non-logically-deleted <c>ScopeAdmin</c> who owns that scope. A <c>User</c> may never own an |
| | | 10 | | /// application (FR-AP-03). |
| | | 11 | | /// </summary> |
| | | 12 | | public class Application : Entity<long> |
| | | 13 | | { |
| | | 14 | | /// <summary> |
| | | 15 | | /// External identifier, generated on creation and used everywhere the application is |
| | | 16 | | /// addressed from outside the database (API paths, response bodies). The internal |
| | | 17 | | /// <see cref="Entity{TKey}.Id" /> is never exposed to callers. |
| | | 18 | | /// </summary> |
| | 1134 | 19 | | public Guid PublicId { get; set; } = Guid.NewGuid(); |
| | | 20 | | |
| | | 21 | | /// <summary>Application display name. Required, max 200 characters.</summary> |
| | | 22 | | [MaxLength(200)] |
| | 759 | 23 | | public string Name { get; set; } = string.Empty; |
| | | 24 | | |
| | | 25 | | /// <summary>Logical deletion flag. Logically deleted applications are excluded from default queries.</summary> |
| | 364 | 26 | | public bool IsDeleted { get; set; } |
| | | 27 | | |
| | | 28 | | /// <summary>Foreign key to the owning <see cref="Scope" /> (internal Id). Required.</summary> |
| | 381 | 29 | | public long ScopeId { get; set; } |
| | | 30 | | |
| | | 31 | | /// <summary>Foreign key to the owning <see cref="Person" /> (internal Id). Required.</summary> |
| | 310 | 32 | | public long OwnerId { get; set; } |
| | | 33 | | |
| | | 34 | | /// <summary>Creation timestamp.</summary> |
| | 105 | 35 | | public DateTime CreatedAt { get; set; } |
| | | 36 | | |
| | | 37 | | /// <summary>Last update timestamp.</summary> |
| | 154 | 38 | | public DateTime UpdatedAt { get; set; } |
| | | 39 | | |
| | | 40 | | // Navigation properties |
| | | 41 | | |
| | | 42 | | /// <summary>The scope this application belongs to.</summary> |
| | 353 | 43 | | public Scope Scope { get; set; } = null!; |
| | | 44 | | |
| | | 45 | | /// <summary>The person that owns this application.</summary> |
| | 227 | 46 | | public Person Owner { get; set; } = null!; |
| | | 47 | | |
| | | 48 | | /// <summary>The secrets this application can exchange for an application token (UC-53).</summary> |
| | 392 | 49 | | public ICollection<ApplicationCredential> Credentials { get; set; } = new List<ApplicationCredential>(); |
| | | 50 | | } |