using AutoMapper;
using SiNan.Model.Core;
using SiNan.Model.Dto;

namespace SiNan.Model
{
    public class MappingProfiles : Profile
    {
        public MappingProfiles()
        {
            CreateMap<ProductResponse, ProductGOIResponse>();
            CreateMap<ProductSkuResponse, ProductSkuGOIResponse>();

            CreateMap<TempProduct, ProductGOIResponse>().ForPath(t => t.ProductGOI_Yestoday.Cost, opt => opt.MapFrom(f => f.YestodayCost))
                                                        .ForPath(t => t.ProductGOI_Yestoday.Profit, opt => opt.MapFrom(f => f.YestodayProductLevelProfit))
                                                        .ForPath(t => t.PromotionGOI_Yestoday.Cost, opt => opt.MapFrom(f => f.YestodayCost))
                                                        .ForPath(t => t.PromotionGOI_Yestoday.Profit, opt => opt.MapFrom(f => f.YestodayPopularizeLevelProfit))
                                                        .ForPath(t => t.ProductGOI_Recent7Day.Cost, opt => opt.MapFrom(f => f.Recent7dCost))
                                                        .ForPath(t => t.ProductGOI_Recent7Day.Profit, opt => opt.MapFrom(f => f.Recent7dProductLevelProfit))
                                                        .ForPath(t => t.PromotionGOI_Recent7Day.Cost, opt => opt.MapFrom(f => f.Recent7dCost))
                                                        .ForPath(t => t.PromotionGOI_Recent7Day.Profit, opt => opt.MapFrom(f => f.Recent7dPopularizeLevelProfit))
                                                        .ForPath(t => t.ProductGOI_Recent30Day.Cost, opt => opt.MapFrom(f => f.Recent30dCost))
                                                        .ForPath(t => t.ProductGOI_Recent30Day.Profit, opt => opt.MapFrom(f => f.Recent30dProductLevelProfit))
                                                        .ForPath(t => t.PromotionGOI_Recent30Day.Cost, opt => opt.MapFrom(f => f.Recent30dCost))
                                                        .ForPath(t => t.PromotionGOI_Recent30Day.Profit, opt => opt.MapFrom(f => f.Recent30dPopularizeLevelProfit));

            CreateMap<TempProductSku, ProductSkuGOIResponse>().ForPath(t => t.ProductGOI_Yestoday.Cost, opt => opt.MapFrom(f => f.YestodayCost))
                                                              .ForPath(t => t.ProductGOI_Yestoday.Profit, opt => opt.MapFrom(f => f.YestodayProductLevelProfit))
                                                              .ForPath(t => t.PromotionGOI_Yestoday.Cost, opt => opt.MapFrom(f => f.YestodayCost))
                                                              .ForPath(t => t.PromotionGOI_Yestoday.Profit, opt => opt.MapFrom(f => f.YestodayPopularizeLevelProfit))
                                                              .ForPath(t => t.ProductGOI_Recent7Day.Cost, opt => opt.MapFrom(f => f.Recent7dCost))
                                                              .ForPath(t => t.ProductGOI_Recent7Day.Profit, opt => opt.MapFrom(f => f.Recent7dProductLevelProfit))
                                                              .ForPath(t => t.PromotionGOI_Recent7Day.Cost, opt => opt.MapFrom(f => f.Recent7dCost))
                                                              .ForPath(t => t.PromotionGOI_Recent7Day.Profit, opt => opt.MapFrom(f => f.Recent7dPopularizeLevelProfit))
                                                              .ForPath(t => t.ProductGOI_Recent30Day.Cost, opt => opt.MapFrom(f => f.Recent30dCost))
                                                              .ForPath(t => t.ProductGOI_Recent30Day.Profit, opt => opt.MapFrom(f => f.Recent30dProductLevelProfit))
                                                              .ForPath(t => t.PromotionGOI_Recent30Day.Cost, opt => opt.MapFrom(f => f.Recent30dCost))
                                                              .ForPath(t => t.PromotionGOI_Recent30Day.Profit, opt => opt.MapFrom(f => f.Recent30dPopularizeLevelProfit));
        }
    }
}