using System;
using AutoMapper;
using Qusion.Cms.Core.Domain;
using Qusion.Cms.Modules.Blogs.Core;
using Qusion.Cms.Modules.Blogs.Domain;
using Qusion.Framework;

namespace Qusion.WebApp.Areas.cms.Models.Blogs
{
    /// <summary>
    /// Auto mapping from domain to models classes and vice versa
    /// </summary>
    public class BlogProfile : Profile
    {
        private readonly BlogService _blogService;

        public BlogProfile(BlogService blogService)
        {
            _blogService = blogService;
        }

        protected override void Configure()
        {
            CreateMap<Blog, BlogListModel>();
            CreateMap<Blog, BlogModel>();
         

            CreateMap<BlogPost, BlogPostListModel>()
                .ForMember(x => x.BlogID, o => o.MapFrom(x => x.Blog.ID));

          

            CreateMap<BlogPost, PostModel>()
                .ForMember(x => x.Status, o => o.MapFrom(x => x.Status.Value))
                .ForMember(x => x.BlogID, o => o.MapFrom(x => x.Blog.GuidID));

          

            CreateMap<BlogQueryInput, BlogQuery>()
                .ConstructUsing(x => BlogQuery.Default);

            CreateMap<BlogPostQueryInput, BlogPostQuery>()
                .ConstructUsing(x => BlogPostQuery.Default);
        }

      
    }
}