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

namespace MileageTraker.Web.ViewModels.Vehicle
{
	public class VehicleMileageViewModel
	{
		public IEnumerable<VehicleMileageItem> Items { get; set; }
		public LogQueryViewModel Query { get; set; }

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

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