using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Jellyfin.Data.Enums; namespace Jellyfin.Data.Entities { /// /// An entity representing whether the associated user has a specific permission. /// public partial class Permission : ISavingChanges { /// /// Initializes a new instance of the class. /// Public constructor with required data. /// /// The permission kind. /// The value of this permission. public Permission(PermissionKind kind, bool value) { Kind = kind; Value = value; Init(); } /// /// Initializes a new instance of the class. /// Default constructor. Protected due to required properties, but present because EF needs it. /// protected Permission() { Init(); } /************************************************************************* * Properties *************************************************************************/ /// /// Gets or sets the id of this permission. /// /// /// Identity, Indexed, Required. /// [Key] [Required] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; protected set; } /// /// Gets or sets the type of this permission. /// /// /// Required. /// [Required] public PermissionKind Kind { get; protected set; } /// /// Gets or sets a value indicating whether the associated user has this permission. /// /// /// Required. /// [Required] public bool Value { get; set; } /// /// Gets or sets the row version. /// /// /// Required, ConcurrencyToken. /// [ConcurrencyCheck] [Required] public uint RowVersion { get; set; } /// /// Static create function (for use in LINQ queries, etc.) /// /// The permission kind. /// The value of this permission. /// The newly created instance. public static Permission Create(PermissionKind kind, bool value) { return new Permission(kind, value); } /// public void OnSavingChanges() { RowVersion++; } partial void Init(); } }