ApiBaseItem.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.Collections.Generic;
  3. using MediaBrowser.Model.Entities;
  4. using MediaBrowser.Model.Users;
  5. namespace MediaBrowser.Model.DTO
  6. {
  7. /// <summary>
  8. /// This is a concrete class that the UI can use to deserialize
  9. /// It is flat in the sense that it will be used regardless of the type of BaseItem involved
  10. /// </summary>
  11. public class ApiBaseItem : BaseItem
  12. {
  13. // Series properties
  14. public string Status { get; set; }
  15. public IEnumerable<DayOfWeek> AirDays { get; set; }
  16. public string AirTime { get; set; }
  17. }
  18. /// <summary>
  19. /// This is the full return object when requesting an Item
  20. /// </summary>
  21. public class BaseItemContainer<TItemType>
  22. where TItemType : BaseItem
  23. {
  24. public TItemType Item { get; set; }
  25. public UserItemData UserItemData { get; set; }
  26. public IEnumerable<BaseItemContainer<TItemType>> Children { get; set; }
  27. public bool IsFolder { get; set; }
  28. public Guid? ParentId { get; set; }
  29. public string Type { get; set; }
  30. public bool IsType(Type type)
  31. {
  32. return IsType(type.Name);
  33. }
  34. public bool IsType(string type)
  35. {
  36. return Type.Equals(type, StringComparison.OrdinalIgnoreCase);
  37. }
  38. public IEnumerable<BaseItemPerson> People { get; set; }
  39. public IEnumerable<BaseItemStudio> Studios { get; set; }
  40. /// <summary>
  41. /// If the item does not have a logo, this will hold the Id of the Parent that has one.
  42. /// </summary>
  43. public Guid? ParentLogoItemId { get; set; }
  44. public Guid? ParentBackdropItemId { get; set; }
  45. public int? ParentBackdropCount { get; set; }
  46. }
  47. /// <summary>
  48. /// This is strictly for convenience so the UI's don't have to use the verbose generic syntax of BaseItemWrapper<ApiBaseItem>
  49. /// </summary>
  50. public class ApiBaseItemContainer : BaseItemContainer<ApiBaseItem>
  51. {
  52. }
  53. }