MovieMetadata.cs 2.5 KB

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