using AutoMapper;
using Qusion.Cms.Core.Domain;
using Qusion.Cms.Site;
using Qusion.Cms.Site.Core;
using Qusion.Framework;

namespace Qusion.WebApp.Areas.cms.Models.Pages
{
    public class PageProfile : Profile
    {
        protected override void Configure()
        {
     
            
            Mapper.CreateMap<Page, PageModel>();
            Mapper.CreateMap<Page, PageListModel>()
                .ForMember(x =>x.IsRoot, o => o.MapFrom(x => (x.SiteInfo.Root == x)));
            Mapper.CreateMap<Page, PageSimpleModel>();
      
            Mapper.CreateMap<PageQueryInput, PageQuery>()
               .ConstructUsing(x => PageQuery.Default);
            
            // Templates
            Mapper.CreateMap<PageTemplate, TemplateModel>();
            Mapper.CreateMap<PageTemplate, TemplateSimpleModel>();
        }
    }
}