using AutoMapper;
using SimpleLIS.DTO;
using SimpleLIS.Models;

namespace SimpleLIS;

public class MappingProfile : Profile
{
    public MappingProfile()
    {
        CreateMap<Message, MessageDTO>()
            .ForMember(dest => dest.Observations, opt => opt.MapFrom(src => src.Observations));
        CreateMap<MessageDTO, Message>()
            .ForMember(dest => dest.Patient, opt => opt.Ignore());
        CreateMap<Observation, ObservationDTO>();
        CreateMap<ObservationDTO, Observation>()
            .ForMember(dest => dest.Message, opt => opt.Ignore());
        CreateMap<Patient, PatientDTO>();
        CreateMap<PatientDTO, Patient>()
            .ForMember(dest => dest.Messages, opt => opt.Ignore());
    }
}
