using AutoMapper;
using survey_beta.DTOs.Default;
using survey_beta.DTOs.Response;
using survey_beta.DTOs.Update;
using survey_beta.Models;

namespace survey_beta.Mappers.Profiles
{
    public class AnalyticsProfile : Profile
    {
        public AnalyticsProfile()
        {
            CreateMap<Response, ResponseDto>()
                .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id))
                .ForMember(dest => dest.SurveyId, opt => opt.MapFrom(src => src.SurveyId))
                .ForMember(dest => dest.Answers, opt => opt.MapFrom(src => src.Answers));

            CreateMap<Answer, AnswerDto>()
                .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id))
                .ForMember(dest => dest.QuestionId, opt => opt.MapFrom(src => src.QuestionId));
                
            CreateMap<SurveyAnalytics, SurveyStats>()
                .ForMember(dest => dest.SurveyId, opt => opt.MapFrom(src => src.SurveyId))
                .ForMember(dest => dest.TotalResponses, opt => opt.MapFrom(src => src.TotalResponses));
        }
    }
}
