using AutoMapper;

using skydiveLogs_api.Domain;

namespace skydiveLogs_api.Mapper
{
    public class ModelProfile : Profile
    {
        #region Public Constructors

        public ModelProfile()
        {
            CreateMap<DataContract.JumpReq, Jump>();
            CreateMap<DataContract.JumpTypeReq, JumpType>();
            CreateMap<DataContract.AircraftReq, Aircraft>();
            CreateMap<DataContract.DropZoneReq, DropZone>();
            CreateMap<DataContract.GearReq, Gear>();
            CreateMap<DataContract.UserReq, User>();
            CreateMap<DataContract.ImageReq, UserImage>();
            CreateMap<DataContract.TunnelFlightReq, TunnelFlight>();

            CreateMap<Jump, DataContract.JumpResp>().ForMember(dest => dest.AircraftId, opt => opt.MapFrom(s => s.Aircraft.Id))
                                                    .ForMember(dest => dest.DropZoneId, opt => opt.MapFrom(s => s.DropZone.Id))
                                                    .ForMember(dest => dest.GearId, opt => opt.MapFrom(s => s.Gear.Id))
                                                    .ForMember(dest => dest.JumpTypeId, opt => opt.MapFrom(s => s.JumpType.Id));
            CreateMap<TunnelFlight, DataContract.TunnelFlightResp>();

            CreateMap<Gear, DataContract.GearResp>();
            CreateMap<JumpType, DataContract.JumpTypeResp>();
            CreateMap<Aircraft, DataContract.AircraftResp>();
            CreateMap<Aircraft, DataContract.AircraftSimpleResp>();
            CreateMap<DropZone, DataContract.DropZoneResp>();
            CreateMap<DropZone, DataContract.DropZoneSimpleResp>();
            CreateMap<Tunnel, DataContract.TunnelResp>();
            
            CreateMap<Statistic, DataContract.StatisticResp>();
            CreateMap<Statistic, DataContract.StatisticForChartResp>();
            CreateMap<SimpleSummary, DataContract.SimpleSummaryResp>();

            CreateMap<User, DataContract.UserResp>();
            CreateMap<UserImage, DataContract.ImageResp>();
        }

        #endregion Public Constructors
    }
}