PersonInfo.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #nullable disable
  2. #pragma warning disable CA2227, CS1591
  3. using System;
  4. using System.Collections.Generic;
  5. using Jellyfin.Data.Enums;
  6. using MediaBrowser.Model.Entities;
  7. namespace MediaBrowser.Controller.Entities
  8. {
  9. /// <summary>
  10. /// This is a small Person stub that is attached to BaseItems.
  11. /// </summary>
  12. public sealed class PersonInfo : IHasProviderIds
  13. {
  14. public PersonInfo()
  15. {
  16. ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  17. Id = Guid.NewGuid();
  18. }
  19. /// <summary>
  20. /// Gets or Sets the PersonId.
  21. /// </summary>
  22. public Guid Id { get; set; }
  23. public Guid ItemId { get; set; }
  24. /// <summary>
  25. /// Gets or sets the name.
  26. /// </summary>
  27. /// <value>The name.</value>
  28. public string Name { get; set; }
  29. /// <summary>
  30. /// Gets or sets the role.
  31. /// </summary>
  32. /// <value>The role.</value>
  33. public string Role { get; set; }
  34. /// <summary>
  35. /// Gets or sets the type.
  36. /// </summary>
  37. /// <value>The type.</value>
  38. public PersonKind Type { get; set; }
  39. /// <summary>
  40. /// Gets or sets the ascending sort order.
  41. /// </summary>
  42. /// <value>The sort order.</value>
  43. public int? SortOrder { get; set; }
  44. public string ImageUrl { get; set; }
  45. public Dictionary<string, string> ProviderIds { get; set; }
  46. /// <summary>
  47. /// Returns a <see cref="string" /> that represents this instance.
  48. /// </summary>
  49. /// <returns>A <see cref="string" /> that represents this instance.</returns>
  50. public override string ToString()
  51. {
  52. return Name;
  53. }
  54. public bool IsType(PersonKind type) => Type == type || string.Equals(type.ToString(), Role, StringComparison.OrdinalIgnoreCase);
  55. }
  56. }