class R4ProgramStageToFhirDataProvider extends AbstractProgramStageToFhirDataProvider {

    @Override
    protected void initSearchFilter( @Nonnull FhirVersion fhirVersion, @Nonnull RuleInfo<ProgramStageRule> ruleInfo, @Nonnull SearchFilter searchFilter )
    {
        super.initSearchFilter( fhirVersion, ruleInfo, searchFilter );

        if ( ruleInfo.getRule().getFhirResourceType() == FhirResourceType.QUESTIONNAIRE_RESPONSE )
        {
            searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON + "." + CarePlan.SP_INSTANTIATES_CANONICAL,
                FhirResourceType.PLAN_DEFINITION, DhisResourceType.PROGRAM_METADATA, "program" );
            searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON + "." + CarePlan.SP_INSTANTIATES_URI,
                FhirResourceType.PLAN_DEFINITION, DhisResourceType.PROGRAM_METADATA, "program" );

            searchFilter.addReference( QuestionnaireResponse.SP_QUESTIONNAIRE, FhirResourceType.QUESTIONNAIRE, DhisResourceType.PROGRAM_STAGE_METADATA, "programStage" );
            searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON, FhirResourceType.CARE_PLAN, DhisResourceType.ENROLLMENT, "enrollment" );
            searchFilter.addReference( QuestionnaireResponse.SP_PATIENT, FhirResourceType.PATIENT, DhisResourceType.TRACKED_ENTITY, "trackedEntityInstance" );
            searchFilter.addReference( QuestionnaireResponse.SP_SUBJECT, null, DhisResourceType.TRACKED_ENTITY, "trackedEntityInstance" );
            searchFilter.addReference( LocationExtensionUtils.LOCATION_SEARCH_PARAM, FhirResourceType.LOCATION, DhisResourceType.ORGANIZATION_UNIT, "orgUnit" );
        }
    }

    public  R4ProgramStageToFhirDataProvider( @Nonnull ScriptExecutor scriptExecutor, @Nonnull ProgramMetadataService metadataService, @Nonnull EventService eventService );

}