using System.Collections.Generic;

namespace Quizzer.Models
{
    /// <summary>
    /// Collective knowledge of quizz answers
    /// </summary>
    public class Statistic
    {
        public string QuizzID { get; set; }
        public int Version { get; set; }
        public string StatsJson { get; set; }

        public Statistic()
        {
            QuizzID = String.Empty;
            Version = 0;
            StatsJson = String.Empty;
        }
    }

    public class StatisticsMC : Statistic
    {
        public List<StatisticsMCItem> MCList { get; set; }

        public StatisticsMC()
        {
            MCList = new List<StatisticsMCItem>();
        }

    }

    public class StatisticsMCItem
    {
        public string QuestionID { get; set; }
        public List<int> Counter { get; set; }

        public StatisticsMCItem()
        {
            Counter = new List<int>();
            QuestionID = string.Empty;
        }
    }

    public class StatisticsMCDN : StatisticsMC
    {
        public List<MCQuestion> Questions { get; set; }

        public StatisticsMCDN()
        {
            Questions = new List<MCQuestion>();
        }
    }

    public class StatisticsStudentByCategory
    {
        public string CategoryID { get; set; }
        public string CategoryName { get; set; }
        public int percentage { get; set; }
        private int score;
        private int max;

        public StatisticsStudentByCategory()
        {
            score = 0;
            max = 0;
            percentage = 0;
        }

        public void Update (int theScore, int theMax)
        {
            score += theScore;
            max += theMax;
            percentage = (score * 100) / max;
        }

    }
}
