using Mapster;
using Nirvana.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Waste.Application.SubscribeInfo;
using Waste.Domain;

namespace Waste.Application
{
    public class Mapper : IRegister
    {
        public void Register(TypeAdapterConfig config)
        {
            config.ForType<ApiReportBaseDataItem, ApiReportBaseData>()
                 .Map(dest => dest.weight, src => src.DayWeight.ToString("f2"))
                 .Map(dest => dest.pweight, src => src.DayPureWeight.ToString("f2"))
                 .Map(dest => dest.time, src => src.CreateTime.ToString("yyyy-MM-dd"))
                 .Map(dest => dest.type, src => src.WasteType)
                 ;
            config.ForType<SendThirdMessageSubscribeS2SDto, SendThirdMessageSubscriDto>()
                 .Map(dest => dest.Time, src => src.Time.GetTimeStamp())
                 ;
            config.ForType<SendThirdMessageSubscribeS2SDto, SendThirdMessageSubscriDto>()
                 .Map(dest => dest.Time, src => src.Time.GetTimeStamp())
                 ;
            config.ForType<ResultListByEquS2SDto, ResultListByEquS2CDto>()
                 .Map(dest => dest.Time, src => src.CreateTime.GetTimeStamp())
                 .Map(dest => dest.Weight, src => src.GrossWeight.ToDecimal())
                 ;
        }
    }
}