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

namespace MileageTraker.Web.ViewModels
{
	public class DriverMileageViewModel
	{
		public IEnumerable<DriverMileageItem> Items { get; set; }
		public LogQueryViewModel Query { get; set; }

		public int TotalMiles { get { return Items.Sum(i => i.Miles); } }
		public int TotalTrips { get { return Items.Sum(i => i.TripCount); } }
		public double TotalGasPurchased { get { return Items.Sum(i => i.GasPurchased); } }

		public DriverMileageViewModel(IEnumerable<DriverMileageItem> items, LogQueryViewModel query)
		{
			Items = items;
			Query = query;
		}
	}
}