"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.CfnSnapshotPropsMixin = exports.CfnWorkgroupPropsMixin = exports.CfnNamespacePropsMixin = 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-redshiftserverless"));
/**
 * A collection of database objects and users.
 *
 * @cloudformationResource AWS::RedshiftServerless::Namespace
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshiftserverless-namespace.html
 */
class CfnNamespacePropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_redshiftserverless.CfnNamespacePropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["adminPasswordSecretKmsKeyId", "adminUsername", "adminUserPassword", "dbName", "defaultIamRoleArn", "finalSnapshotName", "finalSnapshotRetentionPeriod", "iamRoles", "kmsKeyId", "logExports", "manageAdminPassword", "namespaceName", "namespaceResourcePolicy", "redshiftIdcApplicationArn", "snapshotCopyConfigurations", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::RedshiftServerless::Namespace`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_redshiftserverless_CfnNamespaceMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnNamespacePropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnNamespaceMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnNamespace.isCfnNamespace(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnNamespacePropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnNamespacePropsMixin = CfnNamespacePropsMixin;
// @ts-ignore TS6133
function flattenCfnNamespaceMixinProps(props) {
    const ret = {};
    if ((props.defaultIamRoleArn !== undefined))
        ret.defaultIamRoleArn = cdk.getRefProperty(props.defaultIamRoleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.defaultIamRoleArn, "defaultIamRoleArn", "iam.IRoleRef | string");
    if ((props.iamRoles !== undefined))
        ret.iamRoles = cdk.mapArrayInPlace(props.iamRoles, (item) => cdk.getRefProperty(item?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(item, "iamRoles", "iam.IRoleRef | string"));
    if ((props.kmsKeyId !== undefined))
        ret.kmsKeyId = cdk.getRefProperty(props.kmsKeyId?.keyRef, 'keyId') ?? cdk.ensureStringOrUndefined(props.kmsKeyId, "kmsKeyId", "kms.IKeyRef | string");
    return ret;
}
/**
 * The collection of compute resources in Amazon Redshift Serverless.
 *
 * @cloudformationResource AWS::RedshiftServerless::Workgroup
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshiftserverless-workgroup.html
 */
class CfnWorkgroupPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_redshiftserverless.CfnWorkgroupPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["baseCapacity", "configParameters", "enhancedVpcRouting", "maxCapacity", "namespaceName", "port", "pricePerformanceTarget", "publiclyAccessible", "recoveryPointId", "securityGroupIds", "snapshotArn", "snapshotName", "snapshotOwnerAccount", "subnetIds", "tags", "trackName", "workgroup", "workgroupName"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::RedshiftServerless::Workgroup`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_redshiftserverless_CfnWorkgroupMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnWorkgroupPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnWorkgroupMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnWorkgroup.isCfnWorkgroup(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnWorkgroupPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnWorkgroupPropsMixin = CfnWorkgroupPropsMixin;
// @ts-ignore TS6133
function flattenCfnWorkgroupMixinProps(props) {
    const ret = {};
    if ((props.securityGroupIds !== undefined))
        ret.securityGroupIds = cdk.mapArrayInPlace(props.securityGroupIds, (item) => cdk.getRefProperty(item?.securityGroupRef, 'securityGroupId') ?? cdk.ensureStringOrUndefined(item, "securityGroupIds", "ec2.ISecurityGroupRef | string"));
    if ((props.subnetIds !== undefined))
        ret.subnetIds = cdk.mapArrayInPlace(props.subnetIds, (item) => cdk.getRefProperty(item?.subnetRef, 'subnetId') ?? cdk.ensureStringOrUndefined(item, "subnetIds", "ec2.ISubnetRef | string"));
    return ret;
}
/**
 * A snapshot object that contains databases.
 *
 * @cloudformationResource AWS::RedshiftServerless::Snapshot
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshiftserverless-snapshot.html
 */
class CfnSnapshotPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_redshiftserverless.CfnSnapshotPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["namespaceName", "retentionPeriod", "snapshotName", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::RedshiftServerless::Snapshot`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_redshiftserverless_CfnSnapshotMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnSnapshotPropsMixin);
            }
            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.CfnSnapshot.isCfnSnapshot(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnSnapshotPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnSnapshotPropsMixin = CfnSnapshotPropsMixin;
