using System.Linq;
using AutoMapper;
using Qusion.Cms.Modules.Articles;
using Qusion.Cms.Modules.Articles.Core;

namespace Qusion.WebApp.Areas.Qusion.Models.Articles
{
    public class ArticleProfile : Profile
    {
        protected override void Configure()
        {
            Mapper.CreateMap<Article, ArticleListModel>();

            Mapper.CreateMap<Article, ArticleModel>()
                .ForMember(x => x.Thumb, o => o.Ignore())
                .ForMember(x => x.Library, o => o.Ignore())
                .ForMember(x => x.Document, o => o.Ignore())
                .ForMember(x => x.LibraryDocument, o => o.Ignore())
                 .ForMember(x => x.Karta, o => o.Ignore());


            Mapper.CreateMap<ArticleCreateInput, Article>()
                .ForMember(x => x.Thumb, o => o.Ignore())
                .ForMember(x => x.Labels, o => o.Ignore())
                .ForMember(x => x.Library, o => o.Ignore())
                .ForMember(x => x.Document, o => o.Ignore())
                .ForMember(x => x.LibraryDocument, o => o.Ignore())
                .ForMember(x => x.Karta, o => o.Ignore()); 

            Mapper.CreateMap<Article, ArticleCreateInput>();

            Mapper.CreateMap<ArticleEditInput, Article>()
                .ForMember(x => x.Thumb, o => o.Ignore())
                .ForMember(x => x.Labels, o => o.Ignore())
                .ForMember(x => x.Library, o => o.Ignore())
                .ForMember(x => x.Document, o => o.Ignore())
                .ForMember(x => x.LibraryDocument, o => o.Ignore())
                .ForMember(x => x.Karta, o => o.Ignore());

            Mapper.CreateMap<Article, ArticleEditInput>();

            Mapper.CreateMap<ArticleSettingsInput, ArticleSettings>();
            Mapper.CreateMap<ArticleSettings, ArticleSettingsInput>();

            Mapper.CreateMap<ArticleQueryInput, ArticleQuery>()
                .ConstructUsing(x => ArticleQuery.Default);
        }
    }
}