/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as t}from"tslib";import{property as e,subclass as i}from"../../../core/accessorSupport/decorators.js";import{SharedTemplateRelationshipNotFound as o}from"../support/sharedTemplateErrors.js";import{TemplateDefinitionBase as r}from"./TemplateDefinitionBase.js";import a from"./parts/FeatureTemplateRelationshipPart.js";let s=class extends r{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,r=e.template?.layer,a=t.relationships?.find(t=>t.catalogId===i),s=r?.relationships?.find(t=>t.catalogId===i);if(!a||!r||!s)throw new o(i);e.relationshipMetadata={destinationField:s.keyField,destinationLayerId:r.layerId,sourceField:a.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:[a],json:{write:!0}})],s.prototype,"relationships",void 0),s=t([i("esri.editing.sharedTemplates.templateDefinitions.FeatureTemplateDefinition")],s);const l=s;export{l as default};
