using System;
using System.Collections.Generic;
using System.Linq;
using BeWo.Data.Entities;
using BeWo.Service.Plugins;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.Extensions;
using BS.Shared.Services;

namespace BeWo.Club74
{

	public class DefaultSaveInterceptor : SaveInterceptor
    {
		public override void BeforeSaveServiceRecord(ServiceRecord sr)
		{
			var duration = (decimal)sr.End.Value.Subtract(sr.Start.Value).TotalMinutes;

			if (duration != sr.RoundedDuration)
			{
				if (duration <= 5)
				{
					sr.RoundedDuration = duration;
				}
			}
		}

    }
}