using System;
using System.Collections.Generic;
using API.Entities.Enums;
using API.Entities.Interfaces;
using API.Services.Plus;
namespace API.Entities;
/// 
/// Represents a Collection of Series for a given User
/// 
public class AppUserCollection : IEntityDate, IHasCoverImage
{
    public int Id { get; set; }
    public required string Title { get; set; }
    /// 
    /// A normalized string used to check if the collection already exists in the DB
    /// 
    public required string NormalizedTitle { get; set; }
    public string? Summary { get; set; }
    /// 
    /// Reading lists that are promoted are only done by admins
    /// 
    public bool Promoted { get; set; }
    public string? CoverImage { get; set; }
    public string PrimaryColor { get; set; }
    public string SecondaryColor { get; set; }
    public bool CoverImageLocked { get; set; }
    /// 
    /// The highest age rating from all Series within the collection
    /// 
    public required AgeRating AgeRating { get; set; } = AgeRating.Unknown;
    public ICollection Items { get; set; } = null!;
    public DateTime Created { get; set; }
    public DateTime LastModified { get; set; }
    public DateTime CreatedUtc { get; set; }
    public DateTime LastModifiedUtc { get; set; }
    // Sync stuff for Kavita+
    /// 
    /// Last time Kavita Synced the Collection with an upstream source (for non Kavita sourced collections)
    /// 
    public DateTime LastSyncUtc { get; set; }
    /// 
    /// Who created/manages the list. Non-Kavita lists are not editable by the user, except to promote
    /// 
    public ScrobbleProvider Source { get; set; } = ScrobbleProvider.Kavita;
    /// 
    /// For Non-Kavita sourced collections, the url to sync from
    /// 
    public string? SourceUrl { get; set; }
    /// 
    /// Total number of items as of the last sync. Not applicable for Kavita managed collections.
    /// 
    public int TotalSourceCount { get; set; }
    /// 
    /// A 
 separated string of all missing series
    /// 
    public string? MissingSeriesFromSource { get; set; }
    public void ResetColorScape()
    {
        PrimaryColor = string.Empty;
        SecondaryColor = string.Empty;
    }
    // Relationship
    public AppUser AppUser { get; set; } = null!;
    public int AppUserId { get; set; }
}