#pragma warning disable CA1711 // Identifiers should not have incorrect suffix
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Enums;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities
{
///
/// An entity representing whether the associated user has a specific permission.
///
public class Permission : IHasConcurrencyToken
{
///
/// 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;
}
///
/// Gets the id of this permission.
///
///
/// Identity, Indexed, Required.
///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; private set; }
///
/// Gets or sets the id of the associated user.
///
public Guid? UserId { get; set; }
///
/// Gets the type of this permission.
///
///
/// Required.
///
public PermissionKind Kind { get; private set; }
///
/// Gets or sets a value indicating whether the associated user has this permission.
///
///
/// Required.
///
public bool Value { get; set; }
///
[ConcurrencyCheck]
public uint RowVersion { get; private set; }
///
public void OnSavingChanges()
{
RowVersion++;
}
}
}