using AutoMapper;
using Qusion.Cms.GenericContent;
using Qusion.Cms.GenericContent.Core;

namespace Qusion.WebApp.Areas.Qusion.Models.GenericContents
{
    public class ContentProfile : Profile
    {
        protected override void Configure()
        {
            Mapper.CreateMap<GenericContent, ContentModel>()
              .ForMember(x => x.PageID, o => o.MapFrom(x => x.Page.ID));
            Mapper.CreateMap<ContentCreateInput, GenericContent>();
            Mapper.CreateMap<ContentEditInput, GenericContent>();

            CreateMap<ContentQueryInput, GenericContentQuery>()
                .ConstructUsing(x => GenericContentQuery.Default);

            Mapper.CreateMap<GenericContent, ContentListModel>()
                   .ForMember(x => x.PageID, o => o.MapFrom(x => x.Page.ID));
        }
    }
}