2
0

PersonInfo.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. }
  18. public Guid ItemId { get; set; }
  19. /// <summary>
  20. /// Gets or sets the name.
  21. /// </summary>
  22. /// <value>The name.</value>
  23. public string Name { get; set; }
  24. /// <summary>
  25. /// Gets or sets the role.
  26. /// </summary>
  27. /// <value>The role.</value>
  28. public string Role { get; set; }
  29. /// <summary>
  30. /// Gets or sets the type.
  31. /// </summary>
  32. /// <value>The type.</value>
  33. public PersonKind Type { get; set; }
  34. /// <summary>
  35. /// Gets or sets the ascending sort order.
  36. /// </summary>
  37. /// <value>The sort order.</value>
  38. public int? SortOrder { get; set; }
  39. public string ImageUrl { get; set; }
  40. public Dictionary<string, string> ProviderIds { get; set; }
  41. /// <summary>
  42. /// Returns a <see cref="string" /> that represents this instance.
  43. /// </summary>
  44. /// <returns>A <see cref="string" /> that represents this instance.</returns>
  45. public override string ToString()
  46. {
  47. return Name;
  48. }
  49. public bool IsType(PersonKind type) => Type == type || string.Equals(type.ToString(), Role, StringComparison.OrdinalIgnoreCase);
  50. }
  51. }