using System;
using System.Collections.Generic;
using Kyoo.Abstractions.Controllers;
using Kyoo.Abstractions.Models.Attributes;
using Kyoo.Utils;
namespace Kyoo.Abstractions.Models
{
///
/// This class contains metadata about .
/// You can have providers even if you don't have the corresponding .
///
public class Provider : IResource, IThumbnails
{
///
public int ID { get; set; }
///
public string Slug { get; set; }
///
/// The name of this provider.
///
public string Name { get; set; }
///
public Dictionary Images { get; set; }
///
/// The path of this provider's logo.
/// By default, the http path for this logo is returned from the public API.
/// This can be disabled using the internal query flag.
///
[SerializeAs("{HOST}/api/providers/{Slug}/logo")]
[Obsolete("Use Images instead of this, this is only kept for the API response.")]
public string Logo => Images?.GetValueOrDefault(Models.Images.Logo);
///
/// The list of libraries that uses this provider.
///
[LoadableRelation] public ICollection Libraries { get; set; }
///
/// Create a new, default,
///
public Provider() { }
///
/// Create a new and specify it's .
/// The is automatically calculated from it's name.
///
/// The name of this provider.
/// The logo of this provider.
public Provider(string name, string logo)
{
Slug = Utility.ToSlug(name);
Name = name;
Images = new Dictionary
{
[Models.Images.Logo] = logo
};
}
}
}