"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CfnTopicPolicyPropsMixin = exports.CfnTopicInlinePolicyPropsMixin = exports.CfnTopicPropsMixin = exports.CfnSubscriptionPropsMixin = void 0;
const jsiiDeprecationWarnings = require("../../../.warnings.jsii.js");
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
/* eslint-disable @stylistic/max-len, eol-last */
const cdk = __importStar(require("aws-cdk-lib/core"));
const service = __importStar(require("aws-cdk-lib/aws-sns"));
/**
 * The `AWS::SNS::Subscription` resource subscribes an endpoint to an Amazon  topic.
 *
 * For a subscription to be created, the owner of the endpoint must` confirm the subscription.
 *
 * @cloudformationResource AWS::SNS::Subscription
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html
 */
class CfnSubscriptionPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_sns.CfnSubscriptionPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["deliveryPolicy", "endpoint", "filterPolicy", "filterPolicyScope", "protocol", "rawMessageDelivery", "redrivePolicy", "region", "replayPolicy", "subscriptionRoleArn", "topicArn"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::SNS::Subscription`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_sns_CfnSubscriptionMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnSubscriptionPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnSubscriptionMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnSubscription.isCfnSubscription(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnSubscriptionPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnSubscriptionPropsMixin = CfnSubscriptionPropsMixin;
// @ts-ignore TS6133
function flattenCfnSubscriptionMixinProps(props) {
    const ret = {};
    if ((props.endpoint !== undefined))
        ret.endpoint = cdk.getRefProperty(props.endpoint?.queueRef, 'queueArn') ?? cdk.getRefProperty(props.endpoint?.functionRef, 'functionArn') ?? cdk.getRefProperty(props.endpoint?.deliveryStreamRef, 'deliveryStreamArn') ?? cdk.getRefProperty(props.endpoint?.versionRef, 'functionArn') ?? cdk.ensureStringOrUndefined(props.endpoint, "endpoint", "sqs.IQueueRef | lambda.IFunctionRef | kinesisfirehose.IDeliveryStreamRef | lambda.IVersionRef | string");
    if ((props.subscriptionRoleArn !== undefined))
        ret.subscriptionRoleArn = cdk.getRefProperty(props.subscriptionRoleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.subscriptionRoleArn, "subscriptionRoleArn", "iam.IRoleRef | string");
    if ((props.topicArn !== undefined))
        ret.topicArn = cdk.getRefProperty(props.topicArn?.topicRef, 'topicArn') ?? cdk.ensureStringOrUndefined(props.topicArn, "topicArn", "sns.ITopicRef | string");
    return ret;
}
/**
 * The `AWS::SNS::Topic` resource creates a topic to which notifications can be published.
 *
 * > One account can create a maximum of 100,000 standard topics and 1,000 FIFO topics. For more information, see [Amazon  endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/sns.html) in the *AWS General Reference* .
 *
 * @cloudformationResource AWS::SNS::Topic
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html
 */
class CfnTopicPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_sns.CfnTopicPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["archivePolicy", "contentBasedDeduplication", "dataProtectionPolicy", "deliveryStatusLogging", "displayName", "fifoThroughputScope", "fifoTopic", "kmsMasterKeyId", "signatureVersion", "subscription", "tags", "topicName", "tracingConfig"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::SNS::Topic`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_sns_CfnTopicMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnTopicPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnTopicMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnTopic.isCfnTopic(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnTopicPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnTopicPropsMixin = CfnTopicPropsMixin;
// @ts-ignore TS6133
function flattenCfnTopicPropsMixinSubscriptionProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        endpoint: (!props.endpoint ? undefined : cdk.getRefProperty(props.endpoint?.functionRef, 'functionArn') ?? cdk.getRefProperty(props.endpoint?.queueRef, 'queueArn') ?? cdk.ensureStringOrUndefined(props.endpoint, "endpoint", "lambda.IFunctionRef | sqs.IQueueRef | string")),
        protocol: (!props.protocol ? undefined : props.protocol)
    };
}
// @ts-ignore TS6133
function flattenCfnTopicMixinProps(props) {
    const ret = {};
    if ((props.kmsMasterKeyId !== undefined))
        ret.kmsMasterKeyId = cdk.getRefProperty(props.kmsMasterKeyId?.keyRef, 'keyArn') ?? cdk.getRefProperty(props.kmsMasterKeyId?.keyRef, 'keyId') ?? cdk.getRefProperty(props.kmsMasterKeyId?.aliasRef, 'aliasName') ?? cdk.ensureStringOrUndefined(props.kmsMasterKeyId, "kmsMasterKeyId", "kms.IKeyRef | kms.IAliasRef | string");
    if ((props.subscription !== undefined))
        ret.subscription = (cdk.isResolvableObject(props.subscription) ? props.subscription : cdk.mapArrayInPlace(props.subscription, (item) => flattenCfnTopicPropsMixinSubscriptionProperty(item)));
    return ret;
}
/**
 * The `AWS::SNS::TopicInlinePolicy` resource associates one Amazon  topic with one policy.
 *
 * @cloudformationResource AWS::SNS::TopicInlinePolicy
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topicinlinepolicy.html
 */
class CfnTopicInlinePolicyPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_sns.CfnTopicInlinePolicyPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["policyDocument", "topicArn"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::SNS::TopicInlinePolicy`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_sns_CfnTopicInlinePolicyMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnTopicInlinePolicyPropsMixin);
            }
            throw error;
        }
        this.props = props;
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnTopicInlinePolicy.isCfnTopicInlinePolicy(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnTopicInlinePolicyPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnTopicInlinePolicyPropsMixin = CfnTopicInlinePolicyPropsMixin;
/**
 * The `AWS::SNS::TopicPolicy` resource associates Amazon  topics with a policy.
 *
 * For an example snippet, see [Declaring an Amazon  policy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-iam.html#scenario-sns-policy) in the *CloudFormation User Guide* .
 *
 * @cloudformationResource AWS::SNS::TopicPolicy
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topicpolicy.html
 */
class CfnTopicPolicyPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_sns.CfnTopicPolicyPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["policyDocument", "topics"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::SNS::TopicPolicy`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_sns_CfnTopicPolicyMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnTopicPolicyPropsMixin);
            }
            throw error;
        }
        this.props = props;
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnTopicPolicy.isCfnTopicPolicy(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnTopicPolicyPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnTopicPolicyPropsMixin = CfnTopicPolicyPropsMixin;
