using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using AutoMapper;
using InventoryTraker.Web.Core;

namespace InventoryTraker.Web.Models
{
	public class InventoryTypeViewModel
	{
		[HiddenInput]
		public int Id { get; set; }

		[Required]
		public string Identifier { get; set; }

		[Required]
		public string Name { get; set; }

		[Required]
		public int UnitsPerCase { get; set; }

		[Required]
		public string ContainerType { get; set; }

		[HiddenInput]
		public string UnitsPerCaseContainerType
		{
			get { return $"{UnitsPerCase} / {ContainerType}"; }
		}

		[Required]
		public double WeightPerCase { get; set; }

		[Required]
		public decimal PricePerCase { get; set; }

		public class AutoMapperProfile : Profile
		{
			public AutoMapperProfile()
			{
				CreateMap<InventoryType, InventoryTypeViewModel>();
				CreateMap<InventoryTypeViewModel, InventoryType>();
			}
		}
	}
}