/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as t}from"tslib";import{property as e,subclass as i}from"../../../core/accessorSupport/decorators.js";import{SharedTemplateRelationshipNotFound as r}from"../support/sharedTemplateErrors.js";import{TemplateDefinitionBase as a}from"./TemplateDefinitionBase.js";import o from"./parts/FeatureTemplateRelationshipPart.js";let s=class extends a{constructor(t){super(t),this.type="feature",this.defaultValues=null,this.relationships=[]}get allParts(){return this.relationships}initializeRelationshipMetadata(t){for(const e of this.relationships){const{relationshipCatalogId:i}=e,a=e.template?.layer,o=t.relationships?.find(t=>t.catalogId===i),s=a?.relationships?.find(t=>t.catalogId===i);if(!o||!a||!s)throw new r(i);e.relationshipMetadata={destinationField:s.keyField,destinationLayerId:a.layerId,sourceField:o.keyField,sourceLayerId:t.layerId}}}};t([e({readOnly:!0})],s.prototype,"type",void 0),t([e()],s.prototype,"allParts",null),t([e({json:{write:!0}})],s.prototype,"defaultValues",void 0),t([e({constructOnly:!0,type:[o],json:{write:!0}})],s.prototype,"relationships",void 0),s=t([i("esri.editing.sharedTemplates.templateDefinitions.FeatureTemplateDefinition")],s);export{s as default};
