"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Annotations=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),cxschema=require("../../cloud-assembly-schema"),cxapi=require("../../cx-api"),constructs_1=require("constructs"),DEPRECATIONS_SYMBOL=Symbol.for("@aws-cdk/core.deprecations");class Annotations{constructor(scope){this.scope=scope;const disableTrace=scope.node.tryGetContext(cxapi.DISABLE_METADATA_STACK_TRACE)||process.env.CDK_DISABLE_STACK_TRACE;this.stackTraces=!disableTrace}static of(scope){return new Annotations(scope)}addWarning(message){this.addMessage(cxschema.ArtifactMetadataEntryType.WARN,message)}addInfo(message){this.addMessage(cxschema.ArtifactMetadataEntryType.INFO,message)}addError(message){this.addMessage(cxschema.ArtifactMetadataEntryType.ERROR,message)}addDeprecation(api,message){const text=`The API ${api} is deprecated: ${message}. This API will be removed in the next major release`;if(process.env.CDK_BLOCK_DEPRECATIONS)throw new Error(`${constructs_1.Node.of(this.scope).path}: ${text}`);const set=this.deprecationsReported;set.has(api)||(this.addWarning(text),set.add(api))}addMessage(level,message){constructs_1.Node.of(this.scope).addMetadata(level,message,{stackTrace:this.stackTraces})}get deprecationsReported(){let set=this.scope[DEPRECATIONS_SYMBOL];return set||(set=new Set,Object.defineProperty(this.scope,DEPRECATIONS_SYMBOL,{value:set})),set}}exports.Annotations=Annotations,_a=JSII_RTTI_SYMBOL_1,Annotations[_a]={fqn:"aws-cdk-lib.Annotations",version:"2.29.0"};
//# sourceMappingURL=annotations.js.map
