using System.Collections.Generic;
using System.Linq;
using MileageTraker.Web.ViewModels.Vehicle;

namespace MileageTraker.Web.ViewModels
{
	public class DriverMileageItem
	{
		public string DriverName { get; set; }
		public IEnumerable<VehicleMileageItem> VehicleMileageItems { get; set; }

		public int Miles
		{
			get { return VehicleMileageItems.Sum(i => i.Miles); }
		}

		public double GasPurchased
		{
			get { return VehicleMileageItems.Sum(i => i.GasPurchased); }
		}

		public int TripCount
		{
			get { return VehicleMileageItems.Sum(i => i.LogPairs.Count()); }
		}
	}
}