using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Enums;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
///
/// An entity representing artwork.
///
public class Artwork : IHasConcurrencyToken
{
///
/// Initializes a new instance of the class.
///
/// The path.
/// The kind of art.
public Artwork(string path, ArtKind kind)
{
ArgumentException.ThrowIfNullOrEmpty(path);
Path = path;
Kind = kind;
}
///
/// Gets the id.
///
///
/// Identity, Indexed, Required.
///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; private set; }
///
/// Gets or sets the path.
///
///
/// Required, Max length = 65535.
///
[MaxLength(65535)]
[StringLength(65535)]
public string Path { get; set; }
///
/// Gets or sets the kind of artwork.
///
///
/// Required.
///
public ArtKind Kind { get; set; }
///
[ConcurrencyCheck]
public uint RowVersion { get; private set; }
///
public void OnSavingChanges()
{
RowVersion++;
}
}
}