"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.CfnDashboardPropsMixin = exports.CfnTrailPropsMixin = exports.CfnResourcePolicyPropsMixin = exports.CfnEventDataStorePropsMixin = exports.CfnChannelPropsMixin = 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-cloudtrail"));
/**
 * Contains information about a returned CloudTrail channel.
 *
 * @cloudformationResource AWS::CloudTrail::Channel
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-channel.html
 */
class CfnChannelPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_cloudtrail.CfnChannelPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["destinations", "name", "source", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::CloudTrail::Channel`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_cloudtrail_CfnChannelMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnChannelPropsMixin);
            }
            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.CfnChannel.isCfnChannel(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnChannelPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnChannelPropsMixin = CfnChannelPropsMixin;
/**
 * Creates a new event data store.
 *
 * @cloudformationResource AWS::CloudTrail::EventDataStore
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-eventdatastore.html
 */
class CfnEventDataStorePropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_cloudtrail.CfnEventDataStorePropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["advancedEventSelectors", "billingMode", "contextKeySelectors", "federationEnabled", "federationRoleArn", "ingestionEnabled", "insightsDestination", "insightSelectors", "kmsKeyId", "maxEventSize", "multiRegionEnabled", "name", "organizationEnabled", "retentionPeriod", "tags", "terminationProtectionEnabled"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::CloudTrail::EventDataStore`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_cloudtrail_CfnEventDataStoreMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnEventDataStorePropsMixin);
            }
            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.CfnEventDataStore.isCfnEventDataStore(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnEventDataStorePropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnEventDataStorePropsMixin = CfnEventDataStorePropsMixin;
/**
 * Attaches a resource-based permission policy to a CloudTrail event data store, dashboard, or channel.
 *
 * For more information about resource-based policies, see [CloudTrail resource-based policy examples](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/security_iam_resource-based-policy-examples.html) in the *CloudTrail User Guide* .
 *
 * @cloudformationResource AWS::CloudTrail::ResourcePolicy
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-resourcepolicy.html
 */
class CfnResourcePolicyPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_cloudtrail.CfnResourcePolicyPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["resourceArn", "resourcePolicy"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::CloudTrail::ResourcePolicy`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_cloudtrail_CfnResourcePolicyMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnResourcePolicyPropsMixin);
            }
            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.CfnResourcePolicy.isCfnResourcePolicy(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnResourcePolicyPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnResourcePolicyPropsMixin = CfnResourcePolicyPropsMixin;
/**
 * Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.
 *
 * @cloudformationResource AWS::CloudTrail::Trail
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html
 */
class CfnTrailPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_cloudtrail.CfnTrailPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["advancedEventSelectors", "aggregationConfigurations", "cloudWatchLogsLogGroupArn", "cloudWatchLogsRoleArn", "enableLogFileValidation", "eventSelectors", "includeGlobalServiceEvents", "insightSelectors", "isLogging", "isMultiRegionTrail", "isOrganizationTrail", "kmsKeyId", "s3BucketName", "s3KeyPrefix", "snsTopicName", "tags", "trailName"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::CloudTrail::Trail`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_cloudtrail_CfnTrailMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnTrailPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnTrailMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnTrail.isCfnTrail(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnTrailPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnTrailPropsMixin = CfnTrailPropsMixin;
// @ts-ignore TS6133
function flattenCfnTrailPropsMixinDataResourceProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        type: (!props.type ? undefined : props.type),
        values: (!props.values ? undefined : cdk.mapArrayInPlace(props.values, (item) => cdk.getRefProperty(item?.functionRef, 'functionArn') ?? cdk.ensureStringOrUndefined(item, "values", "lambda.IFunctionRef | string")))
    };
}
// @ts-ignore TS6133
function flattenCfnTrailPropsMixinEventSelectorProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        dataResources: (!props.dataResources ? undefined : (cdk.isResolvableObject(props.dataResources) ? props.dataResources : (!props.dataResources ? undefined : cdk.mapArrayInPlace(props.dataResources, (item) => flattenCfnTrailPropsMixinDataResourceProperty(item))))),
        excludeManagementEventSources: (!props.excludeManagementEventSources ? undefined : props.excludeManagementEventSources),
        includeManagementEvents: (!props.includeManagementEvents ? undefined : props.includeManagementEvents),
        readWriteType: (!props.readWriteType ? undefined : props.readWriteType)
    };
}
// @ts-ignore TS6133
function flattenCfnTrailMixinProps(props) {
    const ret = {};
    if ((props.cloudWatchLogsLogGroupArn !== undefined))
        ret.cloudWatchLogsLogGroupArn = cdk.getRefProperty(props.cloudWatchLogsLogGroupArn?.logGroupRef, 'logGroupArn') ?? cdk.ensureStringOrUndefined(props.cloudWatchLogsLogGroupArn, "cloudWatchLogsLogGroupArn", "logs.ILogGroupRef | string");
    if ((props.cloudWatchLogsRoleArn !== undefined))
        ret.cloudWatchLogsRoleArn = cdk.getRefProperty(props.cloudWatchLogsRoleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.cloudWatchLogsRoleArn, "cloudWatchLogsRoleArn", "iam.IRoleRef | string");
    if ((props.eventSelectors !== undefined))
        ret.eventSelectors = (cdk.isResolvableObject(props.eventSelectors) ? props.eventSelectors : cdk.mapArrayInPlace(props.eventSelectors, (item) => flattenCfnTrailPropsMixinEventSelectorProperty(item)));
    if ((props.kmsKeyId !== undefined))
        ret.kmsKeyId = cdk.getRefProperty(props.kmsKeyId?.keyRef, 'keyArn') ?? cdk.getRefProperty(props.kmsKeyId?.aliasRef, 'aliasName') ?? cdk.getRefProperty(props.kmsKeyId?.keyRef, 'keyId') ?? cdk.ensureStringOrUndefined(props.kmsKeyId, "kmsKeyId", "kms.IKeyRef | kms.IAliasRef | string");
    if ((props.s3BucketName !== undefined))
        ret.s3BucketName = cdk.getRefProperty(props.s3BucketName?.bucketRef, 'bucketName') ?? cdk.ensureStringOrUndefined(props.s3BucketName, "s3BucketName", "s3.IBucketRef | string");
    if ((props.snsTopicName !== undefined))
        ret.snsTopicName = props.snsTopicName;
    return ret;
}
/**
 * Creates a custom dashboard or the Highlights dashboard.
 *
 * - *Custom dashboards* - Custom dashboards allow you to query events in any event data store type. You can add up to 10 widgets to a custom dashboard. You can manually refresh a custom dashboard, or you can set a refresh schedule.
 * - *Highlights dashboard* - You can create the Highlights dashboard to see a summary of key user activities and API usage across all your event data stores. CloudTrail Lake manages the Highlights dashboard and refreshes the dashboard every 6 hours. To create the Highlights dashboard, you must set and enable a refresh schedule.
 *
 * CloudTrail runs queries to populate the dashboard's widgets during a manual or scheduled refresh. CloudTrail must be granted permissions to run the `StartQuery` operation on your behalf. To provide permissions, run the `PutResourcePolicy` operation to attach a resource-based policy to each event data store. For more information, see [Example: Allow CloudTrail to run queries to populate a dashboard](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/security_iam_resource-based-policy-examples.html#security_iam_resource-based-policy-examples-eds-dashboard) in the *AWS CloudTrail User Guide* .
 *
 * To set a refresh schedule, CloudTrail must be granted permissions to run the `StartDashboardRefresh` operation to refresh the dashboard on your behalf. To provide permissions, run the `PutResourcePolicy` operation to attach a resource-based policy to the dashboard. For more information, see [Resource-based policy example for a dashboard](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/security_iam_resource-based-policy-examples.html#security_iam_resource-based-policy-examples-dashboards) in the *AWS CloudTrail User Guide* .
 *
 * For more information about dashboards, see [CloudTrail Lake dashboards](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-dashboard.html) in the *AWS CloudTrail User Guide* .
 *
 * @cloudformationResource AWS::CloudTrail::Dashboard
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-dashboard.html
 */
class CfnDashboardPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_cloudtrail.CfnDashboardPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["name", "refreshSchedule", "tags", "terminationProtectionEnabled", "widgets"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::CloudTrail::Dashboard`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_cloudtrail_CfnDashboardMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnDashboardPropsMixin);
            }
            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.CfnDashboard.isCfnDashboard(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnDashboardPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnDashboardPropsMixin = CfnDashboardPropsMixin;
