<core:FragmentDefinition
	xmlns="sap.m"
	xmlns:core="sap.ui.core"
	xmlns:uxap="sap.uxap"
	xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"
	template:require="{
		CORE: 'sap/fe/core/AnnotationHelper',
		MODEL: 'sap/ui/model/odata/v4/AnnotationHelper'
	}">

	<!--
		isMultiple will return false if there is no navigation property. As we want to create a FacetForm
		in case of no navigation property in annotation path and if navigation property and isMultiple false
		we only check for isMultiple
	-->
	<template:if test="{facet>Target/$AnnotationPath@@.MODEL.isMultiple}">
		<template:then>
			<!-- Annotations representing ordered collection of data fields that is used to represent data from multiple data instances -->
			<template:if test="{= ${metaPath>/currentPath}.set('/') }" />
			<template:if test="{= ${metaPath>/currentPath}.set(${facet>Target/$AnnotationPath}) }" />
			<template:if test="{= ${facet>Target/$AnnotationPath}.indexOf('com.sap.vocabularies.UI.v1.LineItem') > -1 ||
								  ${facet>Target/$AnnotationPath}.indexOf('com.sap.vocabularies.UI.v1.PresentationVariant') > -1}">
				<template:then>
					<template:with path="facet>Target/$AnnotationPath" helper="CORE.getTargetContext" var="annotationPath">
						<template:if test="{= ${metaPath>/navigationPath}.set(${facet>Target/$AnnotationPath@@MODEL.getNavigationPath}) }" />
						<core:Fragment fragmentName="sap.fe.controls.ViewSwitchContainer.ViewSwitchContainer" type="XML"/>
						<template:if test="{= ${metaPath>/navigationPath}.delete() }" />
					</template:with>
				</template:then>
				<template:elseif test="{=${facet>Target/$AnnotationPath}.indexOf('com.sap.vocabularies.Communication.v1.Contact') > -1}">
					<Text text="For Contacts Fragment" />
				</template:elseif>
				<template:elseif test="{=${facet>Target/$AnnotationPath}.indexOf('com.sap.vocabularies.UI.v1.Chart') > -1}">
					<Text text="For Chart Fragment" />
				</template:elseif>
			</template:if>
		</template:then>
		<template:else>
			<!-- Forms -->
			<core:Fragment fragmentName="sap.fe.templates.ObjectPage.view.fragments.ObjectPageForm" type="XML"/>
		</template:else>
	</template:if>

</core:FragmentDefinition>