<core:FragmentDefinition xmlns:sfi="sap.ui.comp.smartfield"
						 xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"
						 xmlns="sap.m" xmlns:sfo="sap.ui.comp.smartform" xmlns:build="sap.build"
						 xmlns:smartlink="sap.ui.comp.navpopover"
						 xmlns:core="sap.ui.core">
	<!--
        @classdesc
        @name: Name: sap.suite.ui.generic.template.fragments.SmartFormDataField.fragment.xml
        @description: This fragment contains label value pairs for the smart form derived from UI.DataFields
        @param {Collection(UI.DataField)} [dataField]
    -->

	<template:if test="{= ${dataField>RecordType} === 'com.sap.vocabularies.UI.v1.DataFieldForAnnotation'}">
		<template:then>
			<template:with path="dataField>Target"
						   helper="sap.ui.model.odata.AnnotationHelper.resolvePath" var="contact">
				<HBox binding="{parts: [{path: 'headerFacet>Target'}, {path: 'entitySet>'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getNavigationPathWithExpand'}" 
					visible="{= ${path: 'dataField>com.sap.vocabularies.UI.v1.Hidden'} ? ${path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getBindingForHiddenPath'} : true}">
					<Label id="header::{path: 'headerFacet>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromFacet'}::{path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromDataField'}::Label"
						   labelFor="header::{path: 'headerFacet>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromFacet'}::{path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromDataField'}::Field"
						   text="{path: 'dataField>Label', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}"
						   class="sapSmartTemplatesObjectPageHeaderFormLabel sapUiTinyMarginEnd"/>
					<Link id="header::{path: 'headerFacet>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromFacet'}::{path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromDataField'}::Field"
						  press="._templateEventHandlers.onContactDetails"
						  binding="{parts: [{path: 'dataField>Target'}, {path: 'entitySet>'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getNavigationPathWithExpand'}"
						  text="{path: 'contact>fn', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}"
						  class="sapSmartTemplatesObjectPageHeaderFormField">
						<customData>
							<core:CustomData key="Location" value="Header"/>
							<core:CustomData key="contactDetails" value="{= ${path: 'contact>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getCustomDataForContactPopup'}}"/>
						</customData>
					</Link>
				</HBox>
			</template:with>
		</template:then>
		<template:elseif
				test="{= ${dataField>RecordType} === 'com.sap.vocabularies.UI.v1.DataFieldWithIntentBasedNavigation'}">
			<HBox binding="{parts: [{path: 'headerFacet>Target'}, {path: 'entitySet>'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getNavigationPathWithExpand'}" 
				visible="{= ${path: 'dataField>com.sap.vocabularies.UI.v1.Hidden'} ? ${path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getBindingForHiddenPath'} : true}">
				<Label
						id="header::{path: 'headerFacet>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromFacet'}::{path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromDataField'}::Label"
						text="{parts: [{path: 'dataField>'}, {path: 'entitySet>'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getLabelForDFwithIBN'}"
						class="sapSmartTemplatesObjectPageHeaderFormLabel sapUiTinyMarginEnd"/>
				<Link
						id="header::{path: 'headerFacet>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromFacet'}::{path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromDataField'}::Field"
						text="{parts: [{path: 'dataField>'}, {path: 'entitySet>'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getLinkTextForDFwithIBN'}"
						press="._templateEventHandlers.onDataFieldWithIntentBasedNavigation"
						wrapping="true"
						class="sapSmartTemplatesObjectPageHeaderFormField"
						ariaLabelledBy="header::{path: 'headerFacet>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromFacet'}::{path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromDataField'}::Label">
					<customData>
						<core:CustomData key="SemanticObject"
										 value="{dataField>SemanticObject/String}"/>
						<core:CustomData key="Action" value="{dataField>Action/String}"/>
					</customData>
				</Link>
			</HBox>
		</template:elseif>
		<template:elseif
			test="{= ${dataField>RecordType} === 'com.sap.vocabularies.UI.v1.DataFieldWithNavigationPath'}">
			<HBox
				binding="{parts: [{path: 'headerFacet>Target'}, {path: 'entitySet>'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getNavigationPathWithExpand'}"
				visible="{= ${path: 'dataField>com.sap.vocabularies.UI.v1.Hidden'} ? ${path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getBindingForHiddenPath'} : true}" >
				<Label
					text="{parts: [{path: 'dataField>'}, {path: 'entitySet>'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getLabelForDFwithIBN'}"
					class="sapSmartTemplatesObjectPageHeaderFormLabel sapUiTinyMarginEnd"/>
				<Link
					text="{parts: [{path: 'dataField>'}, {path: 'entitySet>'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getLinkTextForDFwithIBN'}"
					press="._templateEventHandlers.onDataFieldWithNavigationPath"
					wrapping="true" class="sapSmartTemplatesObjectPageHeaderFormField">
					<customData>
						<core:CustomData key="Target" value="{dataField>Target/NavigationPropertyPath}" />
					</customData>
				</Link>
			</HBox>
		</template:elseif>
		<template:elseif test="{= ${dataField>RecordType} !== 'com.sap.vocabularies.UI.v1.DataFieldForAction'}">
			<HBox binding="{parts: [{path: 'headerFacet>Target'}, {path: 'entitySet>'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getNavigationPathWithExpand'}" 
				visible="{= ${path: 'dataField>com.sap.vocabularies.UI.v1.Hidden'} ? ${path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getBindingForHiddenPath'} : true}">
				<sfi:SmartLabel
						id="header::{path: 'headerFacet>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromFacet'}::{path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromDataField'}::Label"
						labelFor="header::{path: 'headerFacet>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromFacet'}::{path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromDataField'}::Field"
						class="{= ${dataField>Criticality} ? 'sapSmartTemplatesObjectPageHeaderFormLabel': 'sapSmartTemplatesObjectPageHeaderFormLabelNCriticcal' }  sapUiTinyMarginEnd"/>
				<!-- TODO: Should also work with ...format -->
				<template:with path="headerFacet>Target" helper="sap.ui.model.odata.AnnotationHelper.gotoEntitySet" var="annotation">
					<sfi:SmartField
							id="header::{path: 'headerFacet>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromFacet'}::{path: 'dataField>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getStableIdPartFromDataField'}::Field"
							contextEditable="false" uomEditable="false" enabled="true" clientSideMandatoryCheck="false"
							value="{parts: [{path: 'dataField>Value'}, {path: 'entitySet>'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.formatWithExpand'}"
							textLabel="{= ${dataField>Label} ? ${path: 'dataField>Label', formatter: 'sap.ui.model.odata.AnnotationHelper.simplePath'} : '' }"
							class="sapSmartTemplatesObjectPageHeaderFormField"
							fetchValueListReadOnly="false">
						<sfi:semanticObjectController>
							<smartlink:SemanticObjectController beforePopoverOpens="._templateEventHandlers.onBeforeSemanticObjectLinkPopoverOpens"
																navigate="._templateEventHandlers.onSemanticObjectLinkPopoverLinkPressed"
																navigationTargetsObtained="._templateEventHandlers.onSemanticObjectLinkNavigationTargetObtained"
																forceLinkRendering="{parts: [{path: 'entitySet>'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.hasQuickViewFacet'}"/>
						</sfi:semanticObjectController>	
						<sfi:configuration>
							<sfi:Configuration
									displayBehaviour="{parts: [{path: 'dataField>'}, {path: 'annotation>'}, {path: 'entitySet>'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getTextArrangementForSmartControl'}"/>
						</sfi:configuration>
						<template:if test="{= ${dataField>Criticality} }">
							<sfi:controlProposal>
								<sfi:ControlProposal>
									<sfi:objectStatus>
										<sfi:ObjectStatus
												criticality="{path: 'dataField>Criticality', formatter: 'sap.ui.model.odata.AnnotationHelper.simplePath'}"
												criticalityRepresentationType="{= (${dataField>CriticalityRepresentation/EnumMember} === 'com.sap.vocabularies.UI.v1.CriticalityRepresentationType/WithoutIcon') ? 'WithoutIcon' : 'WithIcon'}"/>
									</sfi:objectStatus>
								</sfi:ControlProposal>
							</sfi:controlProposal>
						</template:if>
					</sfi:SmartField>
				</template:with>
			</HBox>
		</template:elseif>
	</template:if>


</core:FragmentDefinition>
