"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.CfnAppMonitorPropsMixin = 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-rum"));
/**
 * Creates a CloudWatch RUM app monitor, which you can use to collect telemetry data from your application and send it to CloudWatch RUM.
 *
 * The data includes performance and reliability information such as page load time, client-side errors, and user behavior.
 *
 * After you create an app monitor, sign in to the CloudWatch RUM console to get the JavaScript code snippet to add to your web application. For more information, see [How do I find a code snippet that I've already generated?](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-find-code-snippet.html)
 *
 * @cloudformationResource AWS::RUM::AppMonitor
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rum-appmonitor.html
 */
class CfnAppMonitorPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_rum.CfnAppMonitorPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["appMonitorConfiguration", "customEvents", "cwLogEnabled", "deobfuscationConfiguration", "domain", "domainList", "name", "platform", "resourcePolicy", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::RUM::AppMonitor`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_rum_CfnAppMonitorMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnAppMonitorPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnAppMonitorMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnAppMonitor.isCfnAppMonitor(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnAppMonitorPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnAppMonitorPropsMixin = CfnAppMonitorPropsMixin;
// @ts-ignore TS6133
function flattenCfnAppMonitorPropsMixinAppMonitorConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        allowCookies: (!props.allowCookies ? undefined : props.allowCookies),
        enableXRay: (!props.enableXRay ? undefined : props.enableXRay),
        excludedPages: (!props.excludedPages ? undefined : props.excludedPages),
        favoritePages: (!props.favoritePages ? undefined : props.favoritePages),
        guestRoleArn: (!props.guestRoleArn ? undefined : cdk.getRefProperty(props.guestRoleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.guestRoleArn, "guestRoleArn", "iam.IRoleRef | string")),
        identityPoolId: (!props.identityPoolId ? undefined : cdk.getRefProperty(props.identityPoolId?.identityPoolRef, 'identityPoolId') ?? cdk.ensureStringOrUndefined(props.identityPoolId, "identityPoolId", "cognito.IIdentityPoolRef | string")),
        includedPages: (!props.includedPages ? undefined : props.includedPages),
        metricDestinations: (!props.metricDestinations ? undefined : props.metricDestinations),
        sessionSampleRate: (!props.sessionSampleRate ? undefined : props.sessionSampleRate),
        telemetries: (!props.telemetries ? undefined : props.telemetries)
    };
}
// @ts-ignore TS6133
function flattenCfnAppMonitorMixinProps(props) {
    const ret = {};
    if ((props.appMonitorConfiguration !== undefined))
        ret.appMonitorConfiguration = flattenCfnAppMonitorPropsMixinAppMonitorConfigurationProperty(props.appMonitorConfiguration);
    return ret;
}
