using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
///
/// An entity representing a rating for an entity.
///
public class Rating : IHasConcurrencyToken
{
///
/// Initializes a new instance of the class.
///
/// The value.
public Rating(double value)
{
Value = value;
}
///
/// Gets or sets the id.
///
///
/// Identity, Indexed, Required.
///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
///
/// Gets or sets the value.
///
///
/// Required.
///
public double Value { get; set; }
///
/// Gets or sets the number of votes.
///
public int? Votes { get; set; }
///
[ConcurrencyCheck]
public uint RowVersion { get; set; }
///
/// Gets or sets the rating type.
/// If this is null it's the internal user rating.
///
public virtual RatingSource? RatingType { get; set; }
///
public void OnSavingChanges()
{
RowVersion++;
}
}
}