namespace PARR.API.Contracts.V1.Responses.Statistics
{
    public class StatWorkLoadDataBaseResponse
    {
        public List<StatWorkLoadDataResponse> WorkLoad { get; set; }

        public int WorksCount => WorkLoad?.Sum(t => t.TemplateCount) ?? 0;

        public double AverageWorksCount
        {
            get
            {
                int divider = WorkLoad.Where(t => t.TemplateCount > 0).Count();
                if (divider > 0)
                    return Math.Round((double)WorksCount / divider, 2);

                return 0;
            }
        }//=> Math.Round((double)WorksCount / WorkLoad.Where(t => t.TemplateCount > 0).Count(), 2);
    }

    public class StatWorkLoadDataResponse
    {
        //public DateTimeOffset Date { get; set; }
        public DateOnly Date { get; set; }
        public int TemplateCount { get; set; }
    }
}
