namespace Prefab.Base; /// /// Represents a lookup entity that can be used to represent a PrefabEnum in a database table. /// /// The type that will represent the entity's backed type. public abstract class LookupEntity : ISortOrder where TEnum : PrefabEnum { /// /// The underlying integer value of the enum. /// public int Id { get; set; } // This will match the PrefabEnum's underlying int value /// /// The name of the enum member (e.g., "Pending"). /// public string Name { get; set; } = string.Empty; /// /// The short name of the enum member (e.g., "Pend"). /// public string? ShortName { get; set; } /// /// An optional description of the enum member. /// public string? Description { get; set; } /// public int SortOrder { get; set; } /// /// Default constructor. /// protected LookupEntity() { } /// /// Constructor to create from a PrefabEnum instance. /// protected LookupEntity(TEnum prefabEnum) { Id = prefabEnum.Value; Name = prefabEnum.Name; ShortName = null; // Set as needed Description = null; // Set as needed SortOrder = prefabEnum.Value; // Or set as needed } /// /// Returns all PrefabEnum instances for this type. /// public static IReadOnlyList GetAllEnumInstances() => PrefabEnum.List; }