MovieMetadata.cs 2.5 KB

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