SeriesMetadata.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #pragma warning disable CA2227
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel.DataAnnotations;
  5. using System.ComponentModel.DataAnnotations.Schema;
  6. using Jellyfin.Data.Interfaces;
  7. namespace Jellyfin.Data.Entities.Libraries
  8. {
  9. /// <summary>
  10. /// An entity representing series metadata.
  11. /// </summary>
  12. public class SeriesMetadata : ItemMetadata, IHasCompanies
  13. {
  14. /// <summary>
  15. /// Initializes a new instance of the <see cref="SeriesMetadata"/> class.
  16. /// </summary>
  17. /// <param name="title">The title or name of the object.</param>
  18. /// <param name="language">ISO-639-3 3-character language codes.</param>
  19. /// <param name="series">The series.</param>
  20. public SeriesMetadata(string title, string language, Series series) : base(title, language)
  21. {
  22. if (series == null)
  23. {
  24. throw new ArgumentNullException(nameof(series));
  25. }
  26. series.SeriesMetadata.Add(this);
  27. Networks = new HashSet<Company>();
  28. }
  29. /// <summary>
  30. /// Initializes a new instance of the <see cref="SeriesMetadata"/> class.
  31. /// </summary>
  32. /// <remarks>
  33. /// Default constructor. Protected due to required properties, but present because EF needs it.
  34. /// </remarks>
  35. protected SeriesMetadata()
  36. {
  37. }
  38. /// <summary>
  39. /// Gets or sets the outline.
  40. /// </summary>
  41. /// <remarks>
  42. /// Max length = 1024.
  43. /// </remarks>
  44. [MaxLength(1024)]
  45. [StringLength(1024)]
  46. public string Outline { get; set; }
  47. /// <summary>
  48. /// Gets or sets the plot.
  49. /// </summary>
  50. /// <remarks>
  51. /// Max length = 65535.
  52. /// </remarks>
  53. [MaxLength(65535)]
  54. [StringLength(65535)]
  55. public string Plot { get; set; }
  56. /// <summary>
  57. /// Gets or sets the tagline.
  58. /// </summary>
  59. /// <remarks>
  60. /// Max length = 1024.
  61. /// </remarks>
  62. [MaxLength(1024)]
  63. [StringLength(1024)]
  64. public string Tagline { get; set; }
  65. /// <summary>
  66. /// Gets or sets the country code.
  67. /// </summary>
  68. /// <remarks>
  69. /// Max length = 2.
  70. /// </remarks>
  71. [MaxLength(2)]
  72. [StringLength(2)]
  73. public string Country { get; set; }
  74. /// <summary>
  75. /// Gets or sets a collection containing the networks.
  76. /// </summary>
  77. public virtual ICollection<Company> Networks { get; protected set; }
  78. /// <inheritdoc />
  79. [NotMapped]
  80. public ICollection<Company> Companies => Networks;
  81. }
  82. }