"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.TableEncryptionV2=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var shared_1=()=>{var tmp=require("./shared");return shared_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class TableEncryptionV2{static dynamoOwnedKey(){return new class extends TableEncryptionV2{_renderSseSpecification(){return{sseEnabled:!1}}_renderReplicaSseSpecification(_scope,_region){}}(shared_1().TableEncryption.DEFAULT)}static awsManagedKey(){return new class extends TableEncryptionV2{_renderSseSpecification(){return{sseEnabled:!0,sseType:"KMS"}}_renderReplicaSseSpecification(_scope,_region){}}(shared_1().TableEncryption.AWS_MANAGED)}static customerManagedKey(tableKey,replicaKeyArns={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_kms_IKey(tableKey)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.customerManagedKey),error}return new class extends TableEncryptionV2{_renderSseSpecification(){return{sseEnabled:!0,sseType:"KMS"}}_renderReplicaSseSpecification(scope,replicaRegion){const stackRegion=core_1().Stack.of(scope).region;if(core_1().Token.isUnresolved(stackRegion))throw new Error("Replica SSE specification cannot be rendered in a region agnostic stack");if(replicaKeyArns.hasOwnProperty(stackRegion))throw new Error(`KMS key for deployment region ${stackRegion} cannot be defined in 'replicaKeyArns'`);if(replicaRegion===stackRegion)return{kmsMasterKeyId:tableKey.keyArn};if(!replicaKeyArns.hasOwnProperty(replicaRegion))throw new Error(`KMS key for ${replicaRegion} was not found in 'replicaKeyArns'`);return{kmsMasterKeyId:replicaKeyArns[replicaRegion]}}}(shared_1().TableEncryption.CUSTOMER_MANAGED,tableKey,replicaKeyArns)}constructor(type,tableKey,replicaKeyArns){this.type=type,this.tableKey=tableKey,this.replicaKeyArns=replicaKeyArns}}exports.TableEncryptionV2=TableEncryptionV2,_a=JSII_RTTI_SYMBOL_1,TableEncryptionV2[_a]={fqn:"aws-cdk-lib.aws_dynamodb.TableEncryptionV2",version:"2.148.1"};
