namespace survey_beta.Mappers.Profiles
{
    using AutoMapper;
    using survey_beta.DTOs.Default;
    using survey_beta.DTOs.Response;
    using survey_beta.Models;
    public class ResponseProfile : Profile
    {
        public ResponseProfile()
        {
            CreateMap<ResponseDto, Response>()
                .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id))
                .ForMember(dest => dest.SurveyId, opt => opt.MapFrom(src => src.SurveyId))
                .ForMember(dest => dest.CreatedAt, opt => opt.MapFrom(src => DateTime.UtcNow)) 
                .ForMember(dest => dest.Answers, opt => opt.MapFrom(src => src.Answers));

            CreateMap<AnswerDto, Answer>()
                .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id))
                .ForMember(dest => dest.ResponseId, opt => opt.MapFrom(src => src.ResponseId))
                .ForMember(dest => dest.QuestionId, opt => opt.MapFrom(src => src.QuestionId));
        }
    }
}
