class R4FhirQuestionnaireResponseToProgramStageTransformer extends AbstractFhirQuestionnaireResponseToProgramStageTransformer {

    @Nonnull
    @Override
    protected Reference getProgramStageRef( @Nonnull FhirToDhisTransformerContext context, @Nonnull RuleInfo<ProgramStageRule> ruleInfo, @Nonnull Map<String, Object> scriptVariables, @Nonnull IBaseResource questionnaireResponse )
    {
        final QuestionnaireResponse fhirQuestionnaireResponse = (QuestionnaireResponse) questionnaireResponse;
        final String uri = fhirQuestionnaireResponse.getQuestionnaire();

        if ( uri == null )
        {
            throw new TransformerDataException( "No reference to a questionnaire that is instantiated by this questionnaire response has been given." );
        }

        final IIdType id;
        try
        {
            id = FhirUriUtils.createIdFromUri( uri, FhirResourceType.QUESTIONNAIRE );
        }
        catch ( IllegalArgumentException e )
        {
            throw new TransformerDataException( e.getMessage(), e );
        }

        return Reference.createIdReference( id.getIdPart() );
    }

    public  R4FhirQuestionnaireResponseToProgramStageTransformer( @Nonnull ScriptExecutor scriptExecutor, @Nonnull TrackedEntityMetadataService trackedEntityMetadataService, @Nonnull TrackedEntityService trackedEntityService,
        @Nonnull TrackedEntityRuleRepository trackedEntityRuleRepository, @Nonnull OrganizationUnitService organizationUnitService, @Nonnull ProgramMetadataService programMetadataService, @Nonnull ProgramStageMetadataService programStageMetadataService,
        @Nonnull EventService eventService, @Nonnull FhirResourceMappingRepository resourceMappingRepository, @Nonnull FhirDhisAssignmentRepository fhirDhisAssignmentRepository, @Nonnull ScriptExecutionContext scriptExecutionContext,
        @Nonnull ValueConverter valueConverter );

}