using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace MediaBrowser.Model.Dto
{
///
/// This is strictly used as a data transfer object from the api layer.
/// This holds information about a BaseItem in a format that is convenient for the client.
///
public class BaseItemDto : IHasProviderIds, INotifyPropertyChanged, IItemDto
{
///
/// Gets or sets the name.
///
/// The name.
public string Name { get; set; }
///
/// Gets or sets the id.
///
/// The id.
public string Id { get; set; }
///
/// Gets or sets the date created.
///
/// The date created.
public DateTime? DateCreated { get; set; }
///
/// Gets or sets the name of the sort.
///
/// The name of the sort.
public string SortName { get; set; }
///
/// Gets or sets the premiere date.
///
/// The premiere date.
public DateTime? PremiereDate { get; set; }
///
/// Gets or sets the critic rating.
///
/// The critic rating.
public float? CriticRating { get; set; }
///
/// Gets or sets the critic rating summary.
///
/// The critic rating summary.
public string CriticRatingSummary { get; set; }
///
/// Gets or sets the path.
///
/// The path.
public string Path { get; set; }
///
/// Gets or sets the official rating.
///
/// The official rating.
public string OfficialRating { get; set; }
///
/// Gets or sets the overview.
///
/// The overview.
public string Overview { get; set; }
///
/// Gets or sets the taglines.
///
/// The taglines.
public List Taglines { get; set; }
///
/// Gets or sets the genres.
///
/// The genres.
public List Genres { get; set; }
///
/// Gets or sets the community rating.
///
/// The community rating.
public float? CommunityRating { get; set; }
///
/// Gets or sets the run time ticks.
///
/// The run time ticks.
public long? RunTimeTicks { get; set; }
///
/// Gets or sets the aspect ratio.
///
/// The aspect ratio.
public string AspectRatio { get; set; }
///
/// Gets or sets the production year.
///
/// The production year.
public int? ProductionYear { get; set; }
///
/// Gets or sets the players supported by a game.
///
/// The players.
public int? Players { get; set; }
///
/// Gets or sets the index number.
///
/// The index number.
public int? IndexNumber { get; set; }
///
/// Gets or sets the parent index number.
///
/// The parent index number.
public int? ParentIndexNumber { get; set; }
///
/// Gets or sets the trailer urls.
///
/// The trailer urls.
public List TrailerUrls { get; set; }
///
/// Gets or sets the provider ids.
///
/// The provider ids.
public Dictionary ProviderIds { get; set; }
///
/// Gets or sets the language.
///
/// The language.
public string Language { get; set; }
///
/// Gets or sets a value indicating whether this instance is folder.
///
/// true if this instance is folder; otherwise, false.
public bool IsFolder { get; set; }
///
/// Gets or sets the parent id.
///
/// The parent id.
public string ParentId { get; set; }
///
/// Gets or sets the type.
///
/// The type.
public string Type { get; set; }
///
/// Gets or sets the people.
///
/// The people.
public BaseItemPerson[] People { get; set; }
///
/// Gets or sets the studios.
///
/// The studios.
public StudioDto[] Studios { get; set; }
///
/// If the item does not have a logo, this will hold the Id of the Parent that has one.
///
/// The parent logo item id.
public string ParentLogoItemId { get; set; }
///
/// If the item does not have any backdrops, this will hold the Id of the Parent that has one.
///
/// The parent backdrop item id.
public string ParentBackdropItemId { get; set; }
///
/// Gets or sets the parent backdrop image tags.
///
/// The parent backdrop image tags.
public List ParentBackdropImageTags { get; set; }
///
/// Gets or sets the local trailer count.
///
/// The local trailer count.
public int? LocalTrailerCount { get; set; }
///
/// User data for this item based on the user it's being requested for
///
/// The user data.
public UserItemDataDto UserData { get; set; }
///
/// Gets or sets the recently added item count.
///
/// The recently added item count.
public int? RecentlyAddedItemCount { get; set; }
///
/// Gets or sets the played percentage.
///
/// The played percentage.
public double? PlayedPercentage { get; set; }
///
/// Gets or sets the recursive item count.
///
/// The recursive item count.
public int? RecursiveItemCount { get; set; }
///
/// Gets or sets the child count.
///
/// The child count.
public int? ChildCount { get; set; }
///
/// Gets or sets the name of the series.
///
/// The name of the series.
public string SeriesName { get; set; }
///
/// Gets or sets the series id.
///
/// The series id.
public string SeriesId { get; set; }
///
/// Gets or sets the special feature count.
///
/// The special feature count.
public int? SpecialFeatureCount { get; set; }
///
/// Gets or sets the display preferences id.
///
/// The display preferences id.
public string DisplayPreferencesId { get; set; }
///
/// Gets or sets the status.
///
/// The status.
public SeriesStatus? Status { get; set; }
///
/// Gets or sets the air time.
///
/// The air time.
public string AirTime { get; set; }
///
/// Gets or sets the air days.
///
/// The air days.
public List AirDays { get; set; }
///
/// Gets or sets the index options.
///
/// The index options.
public string[] IndexOptions { get; set; }
///
/// Gets or sets the primary image aspect ratio.
///
/// The primary image aspect ratio.
public double? PrimaryImageAspectRatio { get; set; }
///
/// Gets or sets the artists.
///
/// The artists.
public string[] Artists { get; set; }
///
/// Gets or sets the album.
///
/// The album.
public string Album { get; set; }
///
/// Gets or sets the album artist.
///
/// The album artist.
public string AlbumArtist { get; set; }
///
/// Gets or sets the media streams.
///
/// The media streams.
public List MediaStreams { get; set; }
///
/// Gets or sets the type of the video.
///
/// The type of the video.
public VideoType? VideoType { get; set; }
///
/// Gets or sets the display type of the media.
///
/// The display type of the media.
public string DisplayMediaType { get; set; }
///
/// Determines whether the specified type is type.
///
/// The type.
/// true if the specified type is type; otherwise, false.
public bool IsType(Type type)
{
return IsType(type.Name);
}
///
/// Determines whether the specified type is type.
///
/// The type.
/// true if the specified type is type; otherwise, false.
public bool IsType(string type)
{
return Type.Equals(type, StringComparison.OrdinalIgnoreCase);
}
///
/// Gets or sets the image tags.
///
/// The image tags.
public Dictionary ImageTags { get; set; }
///
/// Gets or sets the backdrop image tags.
///
/// The backdrop image tags.
public List BackdropImageTags { get; set; }
///
/// Gets or sets the screenshot image tags.
///
/// The screenshot image tags.
public List ScreenshotImageTags { get; set; }
///
/// Gets or sets the parent logo image tag.
///
/// The parent logo image tag.
public Guid? ParentLogoImageTag { get; set; }
///
/// Gets or sets the chapters.
///
/// The chapters.
public List Chapters { get; set; }
///
/// Gets or sets the video format.
///
/// The video format.
public VideoFormat? VideoFormat { get; set; }
///
/// Gets or sets the type of the location.
///
/// The type of the location.
public LocationType LocationType { get; set; }
///
/// Gets or sets the type of the iso.
///
/// The type of the iso.
public IsoType? IsoType { get; set; }
///
/// Gets or sets the type of the media.
///
/// The type of the media.
public string MediaType { get; set; }
///
/// Gets or sets the overview HTML.
///
/// The overview HTML.
public string OverviewHtml { get; set; }
///
/// Gets or sets the end date.
///
/// The end date.
public DateTime? EndDate { get; set; }
///
/// Gets or sets the home page URL.
///
/// The home page URL.
public string HomePageUrl { get; set; }
///
/// Gets or sets the production locations.
///
/// The production locations.
public List ProductionLocations { get; set; }
///
/// Gets or sets the budget.
///
/// The budget.
public double? Budget { get; set; }
///
/// Gets or sets the revenue.
///
/// The revenue.
public double? Revenue { get; set; }
///
/// Gets a value indicating whether this instance can resume.
///
/// true if this instance can resume; otherwise, false.
[IgnoreDataMember]
public bool CanResume
{
get { return UserData != null && UserData.PlaybackPositionTicks > 0; }
}
///
/// Gets the resume position ticks.
///
/// The resume position ticks.
[IgnoreDataMember]
public long ResumePositionTicks
{
get { return UserData == null ? 0 : UserData.PlaybackPositionTicks; }
}
///
/// Gets the backdrop count.
///
/// The backdrop count.
[IgnoreDataMember]
public int BackdropCount
{
get { return BackdropImageTags == null ? 0 : BackdropImageTags.Count; }
}
///
/// Gets the screenshot count.
///
/// The screenshot count.
[IgnoreDataMember]
public int ScreenshotCount
{
get { return ScreenshotImageTags == null ? 0 : ScreenshotImageTags.Count; }
}
///
/// Gets a value indicating whether this instance has banner.
///
/// true if this instance has banner; otherwise, false.
[IgnoreDataMember]
public bool HasBanner
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Banner); }
}
///
/// Gets a value indicating whether this instance has art.
///
/// true if this instance has art; otherwise, false.
[IgnoreDataMember]
public bool HasArtImage
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Art); }
}
///
/// Gets a value indicating whether this instance has logo.
///
/// true if this instance has logo; otherwise, false.
[IgnoreDataMember]
public bool HasLogo
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Logo); }
}
///
/// Gets a value indicating whether this instance has thumb.
///
/// true if this instance has thumb; otherwise, false.
[IgnoreDataMember]
public bool HasThumb
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Thumb); }
}
///
/// Gets a value indicating whether this instance has primary image.
///
/// true if this instance has primary image; otherwise, false.
[IgnoreDataMember]
public bool HasPrimaryImage
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Primary); }
}
///
/// Gets a value indicating whether this instance has disc image.
///
/// true if this instance has disc image; otherwise, false.
[IgnoreDataMember]
public bool HasDiscImage
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Disc); }
}
///
/// Gets a value indicating whether this instance has box image.
///
/// true if this instance has box image; otherwise, false.
[IgnoreDataMember]
public bool HasBoxImage
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Box); }
}
///
/// Gets a value indicating whether this instance has menu image.
///
/// true if this instance has menu image; otherwise, false.
[IgnoreDataMember]
public bool HasMenuImage
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Menu); }
}
///
/// Gets a value indicating whether this instance is video.
///
/// true if this instance is video; otherwise, false.
[IgnoreDataMember]
public bool HasTrailer
{
get { return LocalTrailerCount > 0 || (TrailerUrls != null && TrailerUrls.Count > 0); }
}
///
/// Gets a value indicating whether this instance is video.
///
/// true if this instance is video; otherwise, false.
[IgnoreDataMember]
public bool IsVideo
{
get { return string.Equals(MediaType, Entities.MediaType.Video, StringComparison.OrdinalIgnoreCase); }
}
///
/// Gets a value indicating whether this instance is audio.
///
/// true if this instance is audio; otherwise, false.
[IgnoreDataMember]
public bool IsAudio
{
get { return string.Equals(MediaType, Entities.MediaType.Audio, StringComparison.OrdinalIgnoreCase); }
}
///
/// Gets a value indicating whether this instance is game.
///
/// true if this instance is game; otherwise, false.
[IgnoreDataMember]
public bool IsGame
{
get { return string.Equals(MediaType, Entities.MediaType.Game, StringComparison.OrdinalIgnoreCase); }
}
///
/// Gets a value indicating whether this instance is person.
///
/// true if this instance is person; otherwise, false.
[IgnoreDataMember]
public bool IsPerson
{
get { return string.Equals(Type, "Person", StringComparison.OrdinalIgnoreCase); }
}
///
/// Gets a value indicating whether this instance is root.
///
/// true if this instance is root; otherwise, false.
[IgnoreDataMember]
public bool IsRoot
{
get { return string.Equals(Type, "AggregateFolder", StringComparison.OrdinalIgnoreCase); }
}
///
/// Occurs when [property changed].
///
public event PropertyChangedEventHandler PropertyChanged;
}
}