using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Jellyfin.Data.Enums; namespace Jellyfin.Data.Entities { /// /// An entity that represents a user's display preferences for a specific item. /// public class ItemDisplayPreferences { /// /// Initializes a new instance of the class. /// /// The user id. /// The item id. /// The client. public ItemDisplayPreferences(Guid userId, Guid itemId, string client) { UserId = userId; ItemId = itemId; Client = client; SortBy = "SortName"; SortOrder = SortOrder.Ascending; RememberSorting = false; RememberIndexing = false; } /// /// Initializes a new instance of the class. /// protected ItemDisplayPreferences() { } /// /// Gets or sets the Id. /// /// /// Required. /// [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; protected set; } /// /// Gets or sets the user Id. /// /// /// Required. /// public Guid UserId { get; set; } /// /// Gets or sets the id of the associated item. /// /// /// Required. /// public Guid ItemId { get; set; } /// /// Gets or sets the client string. /// /// /// Required. Max Length = 32. /// [Required] [MaxLength(32)] [StringLength(32)] public string Client { get; set; } /// /// Gets or sets the view type. /// /// /// Required. /// public ViewType ViewType { get; set; } /// /// Gets or sets a value indicating whether the indexing should be remembered. /// /// /// Required. /// public bool RememberIndexing { get; set; } /// /// Gets or sets what the view should be indexed by. /// public IndexingKind? IndexBy { get; set; } /// /// Gets or sets a value indicating whether the sorting type should be remembered. /// /// /// Required. /// public bool RememberSorting { get; set; } /// /// Gets or sets what the view should be sorted by. /// /// /// Required. /// [Required] [MaxLength(64)] [StringLength(64)] public string SortBy { get; set; } /// /// Gets or sets the sort order. /// /// /// Required. /// public SortOrder SortOrder { get; set; } } }