using AutoMapper;
using PARR.Domain.DTOs.TaskDTO;

namespace PARR.Core.Infrastructure.Mapping
{
    /// <summary>
    /// Маппинг все что касается Task
    /// </summary>
    internal class TaskMappingProfile : Profile
    {
        public TaskMappingProfile()
        {
            #region TaskItem
            CreateMap<Domain.Entities.TaskEntities.TaskItem, TaskItemBase>()
                .Include<Domain.Entities.TaskEntities.TaskItem, Domain.DTOs.TaskDTO.TaskItem>()
                .Include<Domain.Entities.TaskEntities.TaskItem, Domain.DTOs.TaskDTO.ActiveTask>();

            CreateMap<Domain.Entities.TaskEntities.TaskItem, Domain.DTOs.TaskDTO.TaskItem>();
            #endregion

            #region ActiveTask
            CreateMap<Domain.Entities.TaskEntities.TaskItem, ActiveTask>()
                .ForMember(d => d.Type, o => o.MapFrom(s => s.TaskType))
                .ForMember(d => d.Status, o => o.MapFrom(s => s.TaskStatus));
            #endregion

            #region TaskType
            CreateMap<Domain.Entities.TaskEntities.TaskType, Domain.DTOs.TaskDTO.TaskType>();
            #endregion

            #region TaskStatus
            CreateMap<Domain.Entities.TaskEntities.TaskStatus, Domain.DTOs.TaskDTO.TaskStatus>();
            #endregion
        }
    }
}
