using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MileageTraker.Web.Models
{
	public static class DomainRules
	{
		/// <summary>
		/// Returns the most recent date for which a log can be submitted from today
		/// </summary>
		public static DateTime GetLogEntryCutoff()
		{
			return GetLogEntryCutoff(DateTime.Today);
		}

		/// <summary>
		/// Returns the most recent date for which a log can be submitted given the
		/// reference date
		/// </summary>
		public static DateTime GetLogEntryCutoff(DateTime referenceDate)
		{
			return referenceDate.AddMonths(-1).AddDays(-referenceDate.Day + 1); // last two months
		}
	}
}