using System;
using System.Linq;
using API.Entities.Enums;
using Kavita.Common.Extensions;
namespace API.Data.Metadata
{
///
/// A representation of a ComicInfo.xml file
///
/// See reference of the loose spec here: https://github.com/Kussie/ComicInfoStandard/blob/main/ComicInfo.xsd
public class ComicInfo
{
public string Summary { get; set; }
public string Title { get; set; }
public string Series { get; set; }
public string Number { get; set; }
public string Volume { get; set; }
public string Notes { get; set; }
public string Genre { get; set; }
public int PageCount { get; set; }
// ReSharper disable once InconsistentNaming
public string LanguageISO { get; set; }
///
/// This is the link to where the data was scraped from
///
public string Web { get; set; }
public int Day { get; set; }
public int Month { get; set; }
public int Year { get; set; }
///
/// Rating based on the content. Think PG-13, R for movies. See for valid types
///
public string AgeRating { get; set; }
// public AgeRating AgeRating
// {
// get => ConvertAgeRatingToEnum(_AgeRating);
// set => ConvertAgeRatingToEnum(value);
// }
///
/// User's rating of the content
///
public float UserRating { get; set; }
public string AlternateSeries { get; set; }
public string StoryArc { get; set; }
public string SeriesGroup { get; set; }
public string AlternativeSeries { get; set; }
public string AlternativeNumber { get; set; }
///
/// This is Epub only: calibre:title_sort
/// Represents the sort order for the title
///
public string TitleSort { get; set; }
///
/// This is the Author. For Books, we map creator tag in OPF to this field. Comma separated if multiple.
///
public string Writer { get; set; }
public string Penciller { get; set; }
public string Inker { get; set; }
public string Colorist { get; set; }
public string Letterer { get; set; }
public string CoverArtist { get; set; }
public string Editor { get; set; }
public string Publisher { get; set; }
public static AgeRating ConvertAgeRatingToEnum(string value)
{
return Enum.GetValues()
.SingleOrDefault(t => t.ToDescription().ToUpperInvariant().Equals(value.ToUpperInvariant()), Entities.Enums.AgeRating.Unknown);
}
}
}