aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Data/Entities/Libraries/Season.cs
blob: eb6674dbc3651bd8f8d00c4ca83eafbcaff0b6c1 (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
#pragma warning disable CA2227

using System;
using System.Collections.Generic;

namespace Jellyfin.Data.Entities.Libraries
{
    /// <summary>
    /// An entity representing a season.
    /// </summary>
    public class Season : LibraryItem
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Season"/> class.
        /// </summary>
        /// <param name="series">The series.</param>
        public Season(Series series)
        {
            if (series == null)
            {
                throw new ArgumentNullException(nameof(series));
            }

            series.Seasons.Add(this);

            Episodes = new HashSet<Episode>();
            SeasonMetadata = new HashSet<SeasonMetadata>();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Season"/> class.
        /// </summary>
        /// <remarks>
        /// Default constructor. Protected due to required properties, but present because EF needs it.
        /// </remarks>
        protected Season()
        {
        }

        /// <summary>
        /// Gets or sets the season number.
        /// </summary>
        public int? SeasonNumber { get; set; }

        /// <summary>
        /// Gets or sets the season metadata.
        /// </summary>
        public virtual ICollection<SeasonMetadata> SeasonMetadata { get; protected set; }

        /// <summary>
        /// Gets or sets a collection containing the number of episodes.
        /// </summary>
        public virtual ICollection<Episode> Episodes { get; protected set; }
    }
}