jellyfin-server/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs

92 lines
2.6 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
2020-08-29 17:30:09 +00:00
namespace Jellyfin.Data.Entities.Libraries
{
/// <summary>
/// An entity representing series metadata.
/// </summary>
public class SeriesMetadata : Metadata, IHasCompanies
2020-05-02 21:56:05 +00:00
{
/// <summary>
/// Initializes a new instance of the <see cref="SeriesMetadata"/> class.
2020-05-02 21:56:05 +00:00
/// </summary>
2020-06-19 10:21:49 +00:00
/// <param name="title">The title or name of the object.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="series">The series.</param>
public SeriesMetadata(string title, string language, Series series) : base(title, language)
2020-05-02 21:56:05 +00:00
{
if (series == null)
2020-06-20 08:35:29 +00:00
{
throw new ArgumentNullException(nameof(series));
2020-06-20 08:35:29 +00:00
}
series.SeriesMetadata.Add(this);
2020-05-02 21:56:05 +00:00
Networks = new HashSet<Company>();
2020-05-02 21:56:05 +00:00
}
/// <summary>
/// Initializes a new instance of the <see cref="SeriesMetadata"/> class.
2020-05-02 21:56:05 +00:00
/// </summary>
/// <remarks>
/// Default constructor. Protected due to required properties, but present because EF needs it.
/// </remarks>
protected SeriesMetadata()
2020-05-02 21:56:05 +00:00
{
}
/// <summary>
/// Gets or sets the outline.
2020-05-02 21:56:05 +00:00
/// </summary>
/// <remarks>
/// Max length = 1024.
/// </remarks>
2020-05-02 21:56:05 +00:00
[MaxLength(1024)]
[StringLength(1024)]
public string Outline { get; set; }
2020-05-02 21:56:05 +00:00
/// <summary>
/// Gets or sets the plot.
2020-05-02 21:56:05 +00:00
/// </summary>
/// <remarks>
/// Max length = 65535.
/// </remarks>
2020-05-02 21:56:05 +00:00
[MaxLength(65535)]
[StringLength(65535)]
public string Plot { get; set; }
2020-06-15 21:43:52 +00:00
2020-05-02 21:56:05 +00:00
/// <summary>
/// Gets or sets the tagline.
2020-05-02 21:56:05 +00:00
/// </summary>
/// <remarks>
/// Max length = 1024.
/// </remarks>
2020-05-02 21:56:05 +00:00
[MaxLength(1024)]
[StringLength(1024)]
public string Tagline { get; set; }
2020-05-02 21:56:05 +00:00
/// <summary>
/// Gets or sets the country code.
2020-05-02 21:56:05 +00:00
/// </summary>
/// <remarks>
/// Max length = 2.
/// </remarks>
2020-05-02 21:56:05 +00:00
[MaxLength(2)]
[StringLength(2)]
public string Country { get; set; }
2020-06-15 21:43:52 +00:00
/// <summary>
/// Gets or sets a collection containing the networks.
/// </summary>
2020-05-02 21:56:05 +00:00
public virtual ICollection<Company> Networks { get; protected set; }
/// <inheritdoc />
[NotMapped]
public ICollection<Company> Companies => Networks;
2020-05-02 21:56:05 +00:00
}
}