jellyfin/Jellyfin.Data/Entities/DisplayPreferences.cs

144 lines
4.1 KiB
C#
Raw Normal View History

2020-06-30 18:44:41 -07:00
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Enums;
namespace Jellyfin.Data.Entities
{
2020-07-09 19:00:34 -07:00
/// <summary>
/// An entity representing a user's display preferences.
/// </summary>
2020-06-30 18:44:41 -07:00
public class DisplayPreferences
{
2020-07-09 19:00:34 -07:00
/// <summary>
/// Initializes a new instance of the <see cref="DisplayPreferences"/> class.
/// </summary>
/// <param name="client">The client string.</param>
/// <param name="userId">The user's id.</param>
2020-06-30 18:44:41 -07:00
public DisplayPreferences(string client, Guid userId)
{
RememberIndexing = false;
ShowBackdrop = true;
Client = client;
UserId = userId;
HomeSections = new HashSet<HomeSection>();
}
2020-07-09 19:00:34 -07:00
/// <summary>
/// Initializes a new instance of the <see cref="DisplayPreferences"/> class.
/// </summary>
2020-06-30 18:44:41 -07:00
protected DisplayPreferences()
{
}
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets the Id.
/// </summary>
/// <remarks>
/// Required.
/// </remarks>
2020-06-30 18:44:41 -07:00
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets the user Id.
/// </summary>
/// <remarks>
/// Required.
/// </remarks>
2020-06-30 18:44:41 -07:00
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets the id of the associated item.
/// </summary>
/// <remarks>
/// This is currently unused. In the future, this will allow us to have users set
/// display preferences per item.
/// </remarks>
public Guid? ItemId { get; set; }
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets the client string.
/// </summary>
/// <remarks>
/// Required. Max Length = 64.
/// </remarks>
2020-06-30 18:44:41 -07:00
[Required]
[MaxLength(64)]
[StringLength(64)]
public string Client { get; set; }
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets a value indicating whether the indexing should be remembered.
/// </summary>
/// <remarks>
/// Required.
/// </remarks>
2020-06-30 18:44:41 -07:00
public bool RememberIndexing { get; set; }
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets a value indicating whether the sorting type should be remembered.
/// </summary>
/// <remarks>
/// Required.
/// </remarks>
2020-06-30 18:44:41 -07:00
public bool RememberSorting { get; set; }
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets the sort order.
/// </summary>
/// <remarks>
/// Required.
/// </remarks>
2020-06-30 18:44:41 -07:00
public SortOrder SortOrder { get; set; }
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets a value indicating whether to show the sidebar.
/// </summary>
/// <remarks>
/// Required.
/// </remarks>
2020-06-30 18:44:41 -07:00
public bool ShowSidebar { get; set; }
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets a value indicating whether to show the backdrop.
/// </summary>
/// <remarks>
/// Required.
/// </remarks>
2020-06-30 18:44:41 -07:00
public bool ShowBackdrop { get; set; }
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets what the view should be sorted by.
/// </summary>
2020-07-17 11:46:17 -07:00
[MaxLength(64)]
[StringLength(64)]
2020-06-30 18:44:41 -07:00
public string SortBy { get; set; }
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets the view type.
/// </summary>
2020-06-30 18:44:41 -07:00
public ViewType? ViewType { get; set; }
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets the scroll direction.
/// </summary>
/// <remarks>
/// Required.
/// </remarks>
2020-06-30 18:44:41 -07:00
public ScrollDirection ScrollDirection { get; set; }
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets what the view should be indexed by.
/// </summary>
2020-06-30 18:44:41 -07:00
public IndexingKind? IndexBy { get; set; }
2020-07-09 19:00:34 -07:00
/// <summary>
/// Gets or sets the home sections.
/// </summary>
2020-06-30 18:44:41 -07:00
public virtual ICollection<HomeSection> HomeSections { get; protected set; }
}
}