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

namespace InventoryTraker.Web.Models
{
	public class ProfileForm : IMapFrom<User>, IHaveCustomMappings
	{
		[Required, Display(Name = "Full Name", Prompt = "Full Name (ex: John Doe)...")]
		public string FullName { get; set; }

		[Required, DataType(DataType.EmailAddress), Display(Prompt = "your@email.com...")]
		public string EmailAddress { get; set; }

		public void CreateMappings(IMapperConfiguration configuration)
		{
			configuration.CreateMap<User, ProfileForm>()
				.ForMember(d => d.FullName, opt => opt.MapFrom(s => s.UserName))
				.ForMember(d => d.EmailAddress, opt => opt.MapFrom(s => s.Email));
		}
	}
}