aboutsummaryrefslogtreecommitdiff
path: root/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/ItemDisplayPreferences.cs
blob: 7e75a200b626ece20aa615dd9cd4e9ad27fcba49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Database.Implementations.Enums;

namespace Jellyfin.Data.Entities
{
    /// <summary>
    /// An entity that represents a user's display preferences for a specific item.
    /// </summary>
    public class ItemDisplayPreferences
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ItemDisplayPreferences"/> class.
        /// </summary>
        /// <param name="userId">The user id.</param>
        /// <param name="itemId">The item id.</param>
        /// <param name="client">The client.</param>
        public ItemDisplayPreferences(Guid userId, Guid itemId, string client)
        {
            UserId = userId;
            ItemId = itemId;
            Client = client;

            SortBy = "SortName";
            SortOrder = SortOrder.Ascending;
            RememberSorting = false;
            RememberIndexing = false;
        }

        /// <summary>
        /// Gets the id.
        /// </summary>
        /// <remarks>
        /// Required.
        /// </remarks>
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; private set; }

        /// <summary>
        /// Gets or sets the user Id.
        /// </summary>
        /// <remarks>
        /// Required.
        /// </remarks>
        public Guid UserId { get; set; }

        /// <summary>
        /// Gets or sets the id of the associated item.
        /// </summary>
        /// <remarks>
        /// Required.
        /// </remarks>
        public Guid ItemId { get; set; }

        /// <summary>
        /// Gets or sets the client string.
        /// </summary>
        /// <remarks>
        /// Required. Max Length = 32.
        /// </remarks>
        [MaxLength(32)]
        [StringLength(32)]
        public string Client { get; set; }

        /// <summary>
        /// Gets or sets the view type.
        /// </summary>
        /// <remarks>
        /// Required.
        /// </remarks>
        public ViewType ViewType { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the indexing should be remembered.
        /// </summary>
        /// <remarks>
        /// Required.
        /// </remarks>
        public bool RememberIndexing { get; set; }

        /// <summary>
        /// Gets or sets what the view should be indexed by.
        /// </summary>
        public IndexingKind? IndexBy { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the sorting type should be remembered.
        /// </summary>
        /// <remarks>
        /// Required.
        /// </remarks>
        public bool RememberSorting { get; set; }

        /// <summary>
        /// Gets or sets what the view should be sorted by.
        /// </summary>
        /// <remarks>
        /// Required.
        /// </remarks>
        [MaxLength(64)]
        [StringLength(64)]
        public string SortBy { get; set; }

        /// <summary>
        /// Gets or sets the sort order.
        /// </summary>
        /// <remarks>
        /// Required.
        /// </remarks>
        public SortOrder SortOrder { get; set; }
    }
}