using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
///
/// An entity representing a library.
///
public class Library : IHasConcurrencyToken
{
///
/// Initializes a new instance of the class.
///
/// The name of the library.
/// The path of the library.
public Library(string name, string path)
{
Name = name;
Path = path;
}
///
/// Gets the id.
///
///
/// Identity, Indexed, Required.
///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; private set; }
///
/// Gets or sets the name.
///
///
/// Required, Max length = 128.
///
[MaxLength(128)]
[StringLength(128)]
public string Name { get; set; }
///
/// Gets or sets the root path of the library.
///
///
/// Required.
///
public string Path { get; set; }
///
[ConcurrencyCheck]
public uint RowVersion { get; private set; }
///
public void OnSavingChanges()
{
RowVersion++;
}
}
}