"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.CfnApplicationPropsMixin = exports.CfnDomainPropsMixin = 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-opensearchservice"));
/**
 * The AWS::OpenSearchService::Domain resource creates an Amazon OpenSearch Service domain.
 *
 * @cloudformationResource AWS::OpenSearchService::Domain
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opensearchservice-domain.html
 */
class CfnDomainPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_opensearchservice.CfnDomainPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["accessPolicies", "advancedOptions", "advancedSecurityOptions", "aimlOptions", "automatedSnapshotPauseOptions", "clusterConfig", "cognitoOptions", "deploymentStrategyOptions", "domainArn", "domainEndpointOptions", "domainName", "ebsOptions", "encryptionAtRestOptions", "engineVersion", "identityCenterOptions", "ipAddressType", "logPublishingOptions", "nodeToNodeEncryptionOptions", "offPeakWindowOptions", "skipShardMigrationWait", "snapshotOptions", "softwareUpdateOptions", "tags", "vpcOptions"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::OpenSearchService::Domain`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_opensearchservice_CfnDomainMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnDomainPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnDomainMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnDomain.isCfnDomain(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnDomainPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnDomainPropsMixin = CfnDomainPropsMixin;
// @ts-ignore TS6133
function flattenCfnDomainPropsMixinVPCOptionsProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        egressEnabled: (!props.egressEnabled ? undefined : props.egressEnabled),
        securityGroupIds: (!props.securityGroupIds ? undefined : cdk.mapArrayInPlace(props.securityGroupIds, (item) => cdk.getRefProperty(item?.securityGroupRef, 'securityGroupId') ?? cdk.ensureStringOrUndefined(item, "securityGroupIds", "ec2.ISecurityGroupRef | string"))),
        subnetIds: (!props.subnetIds ? undefined : cdk.mapArrayInPlace(props.subnetIds, (item) => cdk.getRefProperty(item?.subnetRef, 'subnetId') ?? cdk.ensureStringOrUndefined(item, "subnetIds", "ec2.ISubnetRef | string")))
    };
}
// @ts-ignore TS6133
function flattenCfnDomainPropsMixinCognitoOptionsProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        enabled: (!props.enabled ? undefined : props.enabled),
        identityPoolId: (!props.identityPoolId ? undefined : cdk.getRefProperty(props.identityPoolId?.identityPoolRef, 'identityPoolId') ?? cdk.ensureStringOrUndefined(props.identityPoolId, "identityPoolId", "cognito.IIdentityPoolRef | string")),
        roleArn: (!props.roleArn ? undefined : cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string")),
        userPoolId: (!props.userPoolId ? undefined : cdk.getRefProperty(props.userPoolId?.userPoolRef, 'userPoolId') ?? cdk.ensureStringOrUndefined(props.userPoolId, "userPoolId", "cognito.IUserPoolRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnDomainPropsMixinMasterUserOptionsProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        masterUserArn: (!props.masterUserArn ? undefined : cdk.getRefProperty(props.masterUserArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.masterUserArn, "masterUserArn", "iam.IRoleRef | string")),
        masterUserName: (!props.masterUserName ? undefined : props.masterUserName),
        masterUserPassword: (!props.masterUserPassword ? undefined : props.masterUserPassword)
    };
}
// @ts-ignore TS6133
function flattenCfnDomainPropsMixinAdvancedSecurityOptionsInputProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        anonymousAuthDisableDate: (!props.anonymousAuthDisableDate ? undefined : props.anonymousAuthDisableDate),
        anonymousAuthEnabled: (!props.anonymousAuthEnabled ? undefined : props.anonymousAuthEnabled),
        enabled: (!props.enabled ? undefined : props.enabled),
        iamFederationOptions: (!props.iamFederationOptions ? undefined : props.iamFederationOptions),
        internalUserDatabaseEnabled: (!props.internalUserDatabaseEnabled ? undefined : props.internalUserDatabaseEnabled),
        jwtOptions: (!props.jwtOptions ? undefined : props.jwtOptions),
        masterUserOptions: (!props.masterUserOptions ? undefined : (!props.masterUserOptions ? undefined : flattenCfnDomainPropsMixinMasterUserOptionsProperty(props.masterUserOptions))),
        samlOptions: (!props.samlOptions ? undefined : props.samlOptions)
    };
}
// @ts-ignore TS6133
function flattenCfnDomainPropsMixinEncryptionAtRestOptionsProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        enabled: (!props.enabled ? undefined : props.enabled),
        kmsKeyId: (!props.kmsKeyId ? undefined : cdk.getRefProperty(props.kmsKeyId?.keyRef, 'keyId') ?? cdk.ensureStringOrUndefined(props.kmsKeyId, "kmsKeyId", "kms.IKeyRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnDomainMixinProps(props) {
    const ret = {};
    if ((props.advancedSecurityOptions !== undefined))
        ret.advancedSecurityOptions = flattenCfnDomainPropsMixinAdvancedSecurityOptionsInputProperty(props.advancedSecurityOptions);
    if ((props.cognitoOptions !== undefined))
        ret.cognitoOptions = flattenCfnDomainPropsMixinCognitoOptionsProperty(props.cognitoOptions);
    if ((props.encryptionAtRestOptions !== undefined))
        ret.encryptionAtRestOptions = flattenCfnDomainPropsMixinEncryptionAtRestOptionsProperty(props.encryptionAtRestOptions);
    if ((props.vpcOptions !== undefined))
        ret.vpcOptions = flattenCfnDomainPropsMixinVPCOptionsProperty(props.vpcOptions);
    return ret;
}
/**
 * Creates an OpenSearch UI application.
 *
 * For more information, see [Using the OpenSearch user interface in Amazon OpenSearch Service](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/application.html) .
 *
 * @cloudformationResource AWS::OpenSearchService::Application
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opensearchservice-application.html
 */
class CfnApplicationPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_opensearchservice.CfnApplicationPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["appConfigs", "dataSources", "endpoint", "iamIdentityCenterOptions", "kmsKeyArn", "name", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::OpenSearchService::Application`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_opensearchservice_CfnApplicationMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnApplicationPropsMixin);
            }
            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.CfnApplication.isCfnApplication(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnApplicationPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnApplicationPropsMixin = CfnApplicationPropsMixin;
