using System;
using System.Linq.Expressions;
using DocuMed.Domain.Dtos.SmallDtos;
using DocuMed.Domain.Entities.MedicalHistoryTemplate;

namespace DocuMed.Domain.Mappers
{
    public static partial class MedicalHistoryQuestionMapper
    {
        public static MedicalHistoryQuestion AdaptToMedicalHistoryQuestion(this MedicalHistoryQuestionSDto p1)
        {
            return p1 == null ? null : new MedicalHistoryQuestion()
            {
                Question = p1.Question,
                Part = p1.Part,
                QuestionType = p1.QuestionType,
                BodySystem = p1.BodySystem,
                IsSign = p1.IsSign,
                IsSymptom = p1.IsSymptom,
                MedicalHistoryTemplateId = p1.MedicalHistoryTemplateId,
                Id = p1.Id
            };
        }
        public static MedicalHistoryQuestion AdaptTo(this MedicalHistoryQuestionSDto p2, MedicalHistoryQuestion p3)
        {
            if (p2 == null)
            {
                return null;
            }
            MedicalHistoryQuestion result = p3 ?? new MedicalHistoryQuestion();
            
            result.Question = p2.Question;
            result.Part = p2.Part;
            result.QuestionType = p2.QuestionType;
            result.BodySystem = p2.BodySystem;
            result.IsSign = p2.IsSign;
            result.IsSymptom = p2.IsSymptom;
            result.MedicalHistoryTemplateId = p2.MedicalHistoryTemplateId;
            result.Id = p2.Id;
            return result;
            
        }
        public static Expression<Func<MedicalHistoryQuestionSDto, MedicalHistoryQuestion>> ProjectToMedicalHistoryQuestion => p4 => new MedicalHistoryQuestion()
        {
            Question = p4.Question,
            Part = p4.Part,
            QuestionType = p4.QuestionType,
            BodySystem = p4.BodySystem,
            IsSign = p4.IsSign,
            IsSymptom = p4.IsSymptom,
            MedicalHistoryTemplateId = p4.MedicalHistoryTemplateId,
            Id = p4.Id
        };
        public static MedicalHistoryQuestionSDto AdaptToSDto(this MedicalHistoryQuestion p5)
        {
            return p5 == null ? null : new MedicalHistoryQuestionSDto()
            {
                Question = p5.Question,
                Part = p5.Part,
                QuestionType = p5.QuestionType,
                MedicalHistoryTemplateId = p5.MedicalHistoryTemplateId,
                BodySystem = p5.BodySystem,
                IsSign = p5.IsSign,
                IsSymptom = p5.IsSymptom,
                Id = p5.Id
            };
        }
        public static MedicalHistoryQuestionSDto AdaptTo(this MedicalHistoryQuestion p6, MedicalHistoryQuestionSDto p7)
        {
            if (p6 == null)
            {
                return null;
            }
            MedicalHistoryQuestionSDto result = p7 ?? new MedicalHistoryQuestionSDto();
            
            result.Question = p6.Question;
            result.Part = p6.Part;
            result.QuestionType = p6.QuestionType;
            result.MedicalHistoryTemplateId = p6.MedicalHistoryTemplateId;
            result.BodySystem = p6.BodySystem;
            result.IsSign = p6.IsSign;
            result.IsSymptom = p6.IsSymptom;
            result.Id = p6.Id;
            return result;
            
        }
        public static Expression<Func<MedicalHistoryQuestion, MedicalHistoryQuestionSDto>> ProjectToSDto => p8 => new MedicalHistoryQuestionSDto()
        {
            Question = p8.Question,
            Part = p8.Part,
            QuestionType = p8.QuestionType,
            MedicalHistoryTemplateId = p8.MedicalHistoryTemplateId,
            BodySystem = p8.BodySystem,
            IsSign = p8.IsSign,
            IsSymptom = p8.IsSymptom,
            Id = p8.Id
        };
    }
}