namespace Mindforge.API.Models.Flashcards
{
    public class FlashcardLibrarySummary
    {
        public long Id { get; set; }
        public string FilePath { get; set; } = string.Empty;
        public string FileName { get; set; } = string.Empty;
        public string Subject { get; set; } = string.Empty;
        public string Difficulty { get; set; } = string.Empty;
        public int CardCount { get; set; }
        public DateTime CreatedAt { get; set; }
        public DateTime UpdatedAt { get; set; }
    }

    public class FlashcardCard
    {
        public long Id { get; set; }
        public long LibraryId { get; set; }
        public string Front { get; set; } = string.Empty;
        public string Back { get; set; } = string.Empty;
        public int Position { get; set; }
        public int CorrectCount { get; set; }
        public int IncorrectCount { get; set; }
        public DateTime CreatedAt { get; set; }
        public DateTime? LastReviewedAt { get; set; }
    }

    public class FlashcardLibraryDetails : FlashcardLibrarySummary
    {
        public List<FlashcardCard> Cards { get; set; } = [];
    }

    public class FlashcardCardWithLibrary : FlashcardCard
    {
        public string FilePath { get; set; } = string.Empty;
        public string FileName { get; set; } = string.Empty;
        public string Subject { get; set; } = string.Empty;
    }

    public class FlashcardRagDashboard
    {
        public DateTime GeneratedAt { get; set; }
        public List<FlashcardRagSubjectGroup> Subjects { get; set; } = [];
    }

    public class FlashcardRagSubjectGroup
    {
        public string Subject { get; set; } = string.Empty;
        public FlashcardRagSummary Summary { get; set; } = new();
        public List<FlashcardRagSubSubjectGroup> SubSubjects { get; set; } = [];
    }

    public class FlashcardRagSubSubjectGroup
    {
        public string SubSubject { get; set; } = string.Empty;
        public FlashcardRagSummary Summary { get; set; } = new();
        public List<FlashcardRagLibrary> Libraries { get; set; } = [];
    }

    public class FlashcardRagSummary
    {
        public int GreenCount { get; set; }
        public int AmberCount { get; set; }
        public int RedCount { get; set; }
        public int GreyCount { get; set; }
        public int ActiveCount { get; set; }
        public double GreenPercentage { get; set; }
        public double AttentionPercentage { get; set; }
    }

    public class FlashcardRagLibrary
    {
        public long LibraryId { get; set; }
        public string FilePath { get; set; } = string.Empty;
        public string FileName { get; set; } = string.Empty;
        public string Subject { get; set; } = string.Empty;
        public string SubSubject { get; set; } = string.Empty;
        public int CorrectCount { get; set; }
        public int IncorrectCount { get; set; }
        public int CardCount { get; set; }
        public int TotalAnswers { get; set; }
        public double PerformanceRate { get; set; }
        public DateTime? LastReviewedAt { get; set; }
        public string RagStatus { get; set; } = "Grey";
    }
}
