using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using BeWo.Report;
using BeWo.Data.Entities;
using BeWo.Data.Access;
using BeWo.Report.ReportObjects;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.Plugins;
using BeWo.Service.ServiceImplementations;
using BS.Shared.Core;
using BS.Shared;
using BS.Shared.Services;


namespace BeWo.IntegraReports
{
    public class IntegraAuslastungBerechnung : AuslastungBerechnung
	{

        public override void CalculateSoll(MitarbeiterauslastungRO.SupportConceptDetail scDC, DateTime date)
        {
            base.CalculateSoll(scDC, date);

            if (scDC.CostBearer2SupportConcept != null)
            {
                var factory = PluginLoader.FindClass<ServiceRecordStatisticFactory>();

                if (factory != null)
                {
                    var stats = factory.CreateSupportConceptStatisticsImpl(scDC.CostBearer2SupportConcept.Oid.Value, date);

                    scDC.ApprovedHoursPerWeekWithRateFactor = stats.MinutesFreePerWeekAverage / 60;
                    
                }
                
            }
        }
		


	}
}
