using System.ComponentModel.DataAnnotations.Schema; namespace HyperBooru; public enum AclRuleAction { Allow, Deny } public class Acl : HBObject { [ForeignKey("ObjectId")] public HBObject Subject { get; set; } public List Rules { get; set; } } public class Acl : Acl where T : Enum { public Type Type => typeof(T); public new List> Rules { get => base.Rules.Cast>().ToList(); set => base.Rules = value.Cast().ToList(); } } public class AclRule : HBObject { public HBPrincipal Principal { get; set; } public AclRuleAction Action { get; set; } [Column(TypeName = "bigint")] public ulong Permissions { get; set; } } public class AclRule : AclRule where T : Enum { public Type Type => typeof(T); public new T Permissions { get => (T) (object) base.Permissions; set => base.Permissions = (ulong) (object) value; } }