@switch (Question.QuestionType)
{
    case MedicalHistoryQuestionType.Selective:
        <SelectiveMedicalQuestionTemplate Question="@Question.Question" Answer="@Answer.Answer" AnswerChanged="async answer => await AnswerChanging(answer) " />
        break;
    case MedicalHistoryQuestionType.Hourly:
        <HourMedicalQuestionTemplate Question="@Question.Question" Answer="@Answer.Answer" AnswerChanged="async answer => await AnswerChanging(answer) " />
        break;
    case MedicalHistoryQuestionType.Interrogatively:
        <InterrogativelyMedicalQuestionTemplate Question="@Question.Question" Answer="@Answer.Answer" AnswerChanged="async answer => await AnswerChanging(answer) " />
        break;
    case MedicalHistoryQuestionType.YesOrNo:
        <YesOrNoMedicalQuestionTemplate Question="@Question.Question" Answer="@Answer.Answer" AnswerChanged="async answer => await AnswerChanging(answer) " />
        break;
    case MedicalHistoryQuestionType.RosSelective:
        <RosSelectiveMedicalQuestionTemplate IsSymptom="@Question.IsSymptom" IsSign="@Question.IsSign" BodySystem="@Question.BodySystem" Question="@Question.Question" Answer="@Answer.Answer" AnswerChanged="async answer => await AnswerChanging(answer) " />
        break;
    default:
        <InterrogativelyMedicalQuestionTemplate Question="@Question.Question" Answer="@Answer.Answer" AnswerChanged="async answer => await AnswerChanging(answer) " />
        break;
}

@code {
    [Parameter]
    public MedicalHistoryQuestionSDto Question { get; set; } = new();

    [Parameter]
    public MedicalHistoryAnswerSDto Answer { get; set; } = new();

    [Parameter]
    public EventCallback<MedicalHistoryAnswerSDto> AnswerChanged { get; set; }

    private async Task AnswerChanging(string answer)
    {
        Answer = new MedicalHistoryAnswerSDto
            {
                Question = Question.Question,
                QuestionType = Question.QuestionType,
                Answer = answer,
                Part = Question.Part
            };
        await AnswerChanged.InvokeAsync(Answer);
    }

}
