using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Entities
{
public interface IHasImages
{
///
/// Gets the name.
///
/// The name.
string Name { get; set; }
///
/// Gets the path.
///
/// The path.
string Path { get; set; }
///
/// Gets the identifier.
///
/// The identifier.
Guid Id { get; }
///
/// Gets the type of the location.
///
/// The type of the location.
LocationType LocationType { get; }
///
/// Gets the image path.
///
/// Type of the image.
/// Index of the image.
/// System.String.
string GetImagePath(ImageType imageType, int imageIndex);
///
/// Gets the image date modified.
///
/// The image path.
/// DateTime.
DateTime GetImageDateModified(string imagePath);
///
/// Sets the image.
///
/// The type.
/// The index.
/// The path.
void SetImagePath(ImageType type, int index, string path);
///
/// Determines whether the specified type has image.
///
/// The type.
/// Index of the image.
/// true if the specified type has image; otherwise, false.
bool HasImage(ImageType type, int imageIndex);
///
/// Swaps the images.
///
/// The type.
/// The index1.
/// The index2.
/// Task.
Task SwapImages(ImageType type, int index1, int index2);
///
/// Gets the display type of the media.
///
/// The display type of the media.
string DisplayMediaType { get; set; }
///
/// Gets or sets the primary image path.
///
/// The primary image path.
string PrimaryImagePath { get; set; }
///
/// Gets the preferred metadata language.
///
/// System.String.
string GetPreferredMetadataLanguage();
///
/// Validates the images and returns true or false indicating if any were removed.
///
bool ValidateImages();
///
/// Gets or sets the backdrop image paths.
///
/// The backdrop image paths.
List BackdropImagePaths { get; set; }
///
/// Determines whether [contains image with source URL] [the specified URL].
///
/// The URL.
/// true if [contains image with source URL] [the specified URL]; otherwise, false.
bool ContainsImageWithSourceUrl(string url);
}
public static class HasImagesExtensions
{
///
/// Gets the image path.
///
/// The item.
/// Type of the image.
/// System.String.
public static string GetImagePath(this IHasImages item, ImageType imageType)
{
return item.GetImagePath(imageType, 0);
}
public static bool HasImage(this IHasImages item, ImageType imageType)
{
return item.HasImage(imageType, 0);
}
///
/// Sets the image path.
///
/// The item.
/// Type of the image.
/// The path.
public static void SetImagePath(this IHasImages item, ImageType imageType, string path)
{
item.SetImagePath(imageType, 0, path);
}
}
}