using AutoMapper;
using AutoMapper.EquivalencyExpression;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Contracts.DTO;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;

namespace IRaCIS.Core.Application.Service
{
    public class PersonalWorkstation : Profile
    {
        public PersonalWorkstation()
        {
            var userTypeEnumInt = 0;

            var userTypeId = Guid.Empty;


            CreateMap<Trial, CheckToBeDoneDto>()
                   .ForMember(t => t.ExperimentName, u => u.MapFrom(c => c.ExperimentName))
                   .ForMember(t => t.TrialCode, u => u.MapFrom(c => c.TrialCode))
                   .ForMember(t => t.ResearchProgramNo, u => u.MapFrom(c => c.ResearchProgramNo))

                   .ForMember(t => t.UrgentCount, u => u.MapFrom(c => c
                   .SubjectVisitList.Where(t=>(t.CheckState==CheckStateEnum.ToCheck ||t.CheckState==CheckStateEnum.CVIng) && t.IsUrgent).Count()))
                   .ForMember(t => t.ToBeCheckedCount, u => u.MapFrom(c => c
                   .SubjectVisitList.Where(t => t.CheckState == CheckStateEnum.ToCheck ).Count()))
                   .ForMember(t => t.ToBeRepliedCount, u => u.MapFrom(c => c
                   .SubjectVisitList.Where(t => (t.CheckState == CheckStateEnum.ToCheck || t.CheckState == CheckStateEnum.CVIng) && t.IsUrgent).Count()));




            CreateMap<VisitTask, ReReadingApplyToBeDoneDto>();





            CreateMap<VisitTask, ReReadingApprovalToBeDoneDto>();


            

        }
    }

}
