namespace DocuMed.Domain;

public class MapsterRegister : IRegister
{
    public void Register(TypeAdapterConfig config)
    {
        config.NewConfig<MedicalHistory, MedicalHistorySDto>()
            .Map("SectionName", org => org.Section!=null ? org.Section.Name : string.Empty)
            .TwoWays();


        config.NewConfig<Student, StudentSDto>()
            .Map(des=>des.SectionName, org => org.Section != null ? org.Section.Name : string.Empty)
            .Map(des=>des.UniversityName, org => org.University != null ? org.University.Name : string.Empty)
            .Map(des => des.PhoneNumber, org => org.User != null ? org.User.PhoneNumber : string.Empty)
            .Map(des=>des.FirstName, org => org.User != null ? org.User.FirstName : string.Empty)
            .Map(des=>des.LastName, org => org.User != null ? org.User.LastName : string.Empty)
            .Map(des=>des.NationalId, org => org.User != null ? org.User.NationalId : string.Empty)
            .TwoWays();
    }
}