using System;
using System.Collections.Generic;
using API.DTOs.Metadata;
using API.Entities.Enums;
using API.Entities.Interfaces;
namespace API.DTOs;
/// 
/// A Chapter is the lowest grouping of a reading medium. A Chapter contains a set of MangaFiles which represents the underlying
/// file (abstracted from type).
/// 
public class ChapterDto : IHasReadTimeEstimate, IHasCoverImage
{
    public int Id { get; init; }
    /// 
    /// Range of chapters. Chapter 2-4 -> "2-4". Chapter 2 -> "2". If special, will be special name.
    /// 
    /// This can be something like 19.HU or Alpha as some comics are like this
    public string Range { get; init; } = default!;
    /// 
    /// Smallest number of the Range.
    /// 
    [Obsolete("Use MinNumber and MaxNumber instead")]
    public string Number { get; init; } = default!;
    /// 
    /// This may be 0 under the circumstance that the Issue is "Alpha" or other non-standard numbers.
    /// 
    public float MinNumber { get; init; }
    public float MaxNumber { get; init; }
    /// 
    /// The sorting order of the Chapter. Inherits from MinNumber, but can be overridden.
    /// 
    public float SortOrder { get; set; }
    /// 
    /// Total number of pages in all MangaFiles
    /// 
    public int Pages { get; init; }
    /// 
    /// If this Chapter contains files that could only be identified as Series or has Special Identifier from filename
    /// 
    public bool IsSpecial { get; init; }
    /// 
    /// Used for books/specials to display custom title. For non-specials/books, will be set to 
    /// 
    public string Title { get; set; } = default!;
    /// 
    /// The files that represent this Chapter
    /// 
    public ICollection Files { get; init; } = default!;
    /// 
    /// Calculated at API time. Number of pages read for this Chapter for logged in user.
    /// 
    public int PagesRead { get; set; }
    /// 
    /// The last time a chapter was read by current authenticated user
    /// 
    public DateTime LastReadingProgressUtc { get; set; }
    /// 
    /// The last time a chapter was read by current authenticated user
    /// 
    public DateTime LastReadingProgress { get; set; }
    /// 
    /// If the Cover Image is locked for this entity
    /// 
    public bool CoverImageLocked { get; set; }
    /// 
    /// Volume Id this Chapter belongs to
    /// 
    public int VolumeId { get; init; }
    /// 
    /// When chapter was created
    /// 
    public DateTime CreatedUtc { get; set; }
    public DateTime LastModifiedUtc { get; set; }
    /// 
    /// When chapter was created in local server time
    /// 
    /// This is required for Tachiyomi Extension
    public DateTime Created { get; set; }
    /// 
    /// When the chapter was released.
    /// 
    /// Metadata field
    public DateTime ReleaseDate { get; init; }
    /// 
    /// Title of the Chapter/Issue
    /// 
    /// Metadata field
    public string TitleName { get; set; } = default!;
    /// 
    /// Summary of the Chapter
    /// 
    /// This is not set normally, only for Series Detail
    public string Summary { get; init; } = default!;
    /// 
    /// Age Rating for the issue/chapter
    /// 
    public AgeRating AgeRating { get; init; }
    /// 
    /// Total words in a Chapter (books only)
    /// 
    public long WordCount { get; set; } = 0L;
    /// 
    /// Formatted Volume title ie) Volume 2.
    /// 
    /// Only available when fetched from Series Detail API
    public string VolumeTitle { get; set; } = string.Empty;
    /// 
    public int MinHoursToRead { get; set; }
    /// 
    public int MaxHoursToRead { get; set; }
    /// 
    public float AvgHoursToRead { get; set; }
    /// 
    /// Comma-separated link of urls to external services that have some relation to the Chapter
    /// 
    public string WebLinks { get; set; }
    /// 
    /// ISBN-13 (usually) of the Chapter
    /// 
    /// This is guaranteed to be Valid
    public string ISBN { get; set; }
    #region Metadata
    public ICollection Writers { get; set; } = new List();
    public ICollection CoverArtists { get; set; } = new List();
    public ICollection Publishers { get; set; } = new List();
    public ICollection Characters { get; set; } = new List();
    public ICollection Pencillers { get; set; } = new List();
    public ICollection Inkers { get; set; } = new List();
    public ICollection Imprints { get; set; } = new List();
    public ICollection Colorists { get; set; } = new List();
    public ICollection Letterers { get; set; } = new List();
    public ICollection Editors { get; set; } = new List();
    public ICollection Translators { get; set; } = new List();
    public ICollection Teams { get; set; } = new List();
    public ICollection Locations { get; set; } = new List();
    public ICollection Genres { get; set; } = new List();
    /// 
    /// Collection of all Tags from underlying chapters for a Series
    /// 
    public ICollection Tags { get; set; } = new List();
    public PublicationStatus PublicationStatus { get; set; }
    /// 
    /// Language for the Chapter/Issue
    /// 
    public string? Language { get; set; }
    /// 
    /// Number in the TotalCount of issues
    /// 
    public int Count { get; set; }
    /// 
    /// Total number of issues for the series
    /// 
    public int TotalCount { get; set; }
    public bool LanguageLocked { get; set; }
    public bool SummaryLocked { get; set; }
    /// 
    /// Locked by user so metadata updates from scan loop will not override AgeRating
    /// 
    public bool AgeRatingLocked { get; set; }
    /// 
    /// Locked by user so metadata updates from scan loop will not override PublicationStatus
    /// 
    public bool PublicationStatusLocked { get; set; }
    public bool GenresLocked { get; set; }
    public bool TagsLocked { get; set; }
    public bool WriterLocked { get; set; }
    public bool CharacterLocked { get; set; }
    public bool ColoristLocked { get; set; }
    public bool EditorLocked { get; set; }
    public bool InkerLocked { get; set; }
    public bool ImprintLocked { get; set; }
    public bool LettererLocked { get; set; }
    public bool PencillerLocked { get; set; }
    public bool PublisherLocked { get; set; }
    public bool TranslatorLocked { get; set; }
    public bool TeamLocked { get; set; }
    public bool LocationLocked { get; set; }
    public bool CoverArtistLocked { get; set; }
    public bool ReleaseYearLocked { get; set; }
    #endregion
    public string CoverImage { get; set; }
    public string PrimaryColor { get; set; }
    public string SecondaryColor { get; set; }
    public void ResetColorScape()
    {
        PrimaryColor = string.Empty;
        SecondaryColor = string.Empty;
    }
}