"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.CfnScheduleGroupPropsMixin = exports.CfnSchedulePropsMixin = 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-scheduler"));
/**
 * A *schedule* is the main resource you create, configure, and manage using Amazon EventBridge Scheduler.
 *
 * Every schedule has a *schedule expression* that determines when, and with what frequency, the schedule runs. EventBridge Scheduler supports three types of schedules: rate, cron, and one-time schedules. For more information about different schedule types, see [Schedule types](https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html) in the *EventBridge Scheduler User Guide* .
 *
 * When you create a schedule, you configure a target for the schedule to invoke. A target is an API operation that EventBridge Scheduler calls on your behalf every time your schedule runs. EventBridge Scheduler supports two types of targets: *templated* targets invoke common API operations across a core groups of services, and customizeable *universal* targets that you can use to call more than 6,000 operations across over 270 services. For more information about configuring targets, see [Managing targets](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets.html) in the *EventBridge Scheduler User Guide* .
 *
 * For more information about managing schedules, changing the schedule state, setting up flexible time windows, and configuring a dead-letter queue for a schedule, see [Managing a schedule](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-schedule.html) in the *EventBridge Scheduler User Guide* .
 *
 * @cloudformationResource AWS::Scheduler::Schedule
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-scheduler-schedule.html
 */
class CfnSchedulePropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_scheduler.CfnSchedulePropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["description", "endDate", "flexibleTimeWindow", "groupName", "kmsKeyArn", "name", "scheduleExpression", "scheduleExpressionTimezone", "startDate", "state", "target"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::Scheduler::Schedule`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_scheduler_CfnScheduleMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnSchedulePropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnScheduleMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnSchedule.isCfnSchedule(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnSchedulePropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnSchedulePropsMixin = CfnSchedulePropsMixin;
// @ts-ignore TS6133
function flattenCfnSchedulePropsMixinDeadLetterConfigProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        arn: (!props.arn ? undefined : cdk.getRefProperty(props.arn?.queueRef, 'queueArn') ?? cdk.ensureStringOrUndefined(props.arn, "arn", "sqs.IQueueRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnSchedulePropsMixinTargetProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        arn: (!props.arn ? undefined : cdk.getRefProperty(props.arn?.stateMachineRef, 'stateMachineArn') ?? cdk.getRefProperty(props.arn?.functionRef, 'functionArn') ?? cdk.getRefProperty(props.arn?.queueRef, 'queueArn') ?? cdk.ensureStringOrUndefined(props.arn, "arn", "stepfunctions.IStateMachineRef | lambda.IFunctionRef | sqs.IQueueRef | string")),
        deadLetterConfig: (!props.deadLetterConfig ? undefined : (!props.deadLetterConfig ? undefined : flattenCfnSchedulePropsMixinDeadLetterConfigProperty(props.deadLetterConfig))),
        ecsParameters: (!props.ecsParameters ? undefined : props.ecsParameters),
        eventBridgeParameters: (!props.eventBridgeParameters ? undefined : props.eventBridgeParameters),
        input: (!props.input ? undefined : props.input),
        kinesisParameters: (!props.kinesisParameters ? undefined : props.kinesisParameters),
        retryPolicy: (!props.retryPolicy ? undefined : props.retryPolicy),
        roleArn: (!props.roleArn ? undefined : cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string")),
        sageMakerPipelineParameters: (!props.sageMakerPipelineParameters ? undefined : props.sageMakerPipelineParameters),
        sqsParameters: (!props.sqsParameters ? undefined : props.sqsParameters)
    };
}
// @ts-ignore TS6133
function flattenCfnScheduleMixinProps(props) {
    const ret = {};
    if ((props.kmsKeyArn !== undefined))
        ret.kmsKeyArn = cdk.getRefProperty(props.kmsKeyArn?.keyRef, 'keyArn') ?? cdk.ensureStringOrUndefined(props.kmsKeyArn, "kmsKeyArn", "kms.IKeyRef | string");
    if ((props.target !== undefined))
        ret.target = flattenCfnSchedulePropsMixinTargetProperty(props.target);
    return ret;
}
/**
 * A *schedule group* is an Amazon EventBridge Scheduler resource you use to organize your schedules.
 *
 * Your AWS account comes with a `default` scheduler group. You associate a new schedule with the `default` group or with schedule groups that you create and manage. You can create up to [500 schedule groups](https://docs.aws.amazon.com/scheduler/latest/UserGuide/scheduler-quotas.html) in your AWS account. With EventBridge Scheduler, you apply [tags](https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) to schedule groups, not to individual schedules to organize your resources.
 *
 * For more information about managing schedule groups, see [Managing a schedule group](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-schedule-group.html) in the *EventBridge Scheduler User Guide* .
 *
 * @cloudformationResource AWS::Scheduler::ScheduleGroup
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-scheduler-schedulegroup.html
 */
class CfnScheduleGroupPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_scheduler.CfnScheduleGroupPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["name", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::Scheduler::ScheduleGroup`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_scheduler_CfnScheduleGroupMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnScheduleGroupPropsMixin);
            }
            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.CfnScheduleGroup.isCfnScheduleGroup(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnScheduleGroupPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnScheduleGroupPropsMixin = CfnScheduleGroupPropsMixin;
