"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Schedule=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class Schedule{expressionString;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_stepfunctions_tasks.Schedule",version:"2.256.1"};static oneTime(time){const pad=num=>num<10?"0"+num:num,year=time.getFullYear(),month=pad(time.getMonth()+1),day=pad(time.getDate()),hours=pad(time.getHours()),minutes=pad(time.getMinutes()),seconds=pad(time.getSeconds());return new Schedule(`${year}-${month}-${day}T${hours}:${minutes}:${seconds}`)}static rate(duration){try{jsiiDeprecationWarnings().aws_cdk_lib_Duration(duration)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.rate),error}if(duration.toMilliseconds()<core_1().Duration.minutes(1).toMilliseconds())throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`DurationCannotLessThan`,"Duration cannot be less than 1 minute");const maybeRate=(value,unit)=>value>0&&Number.isInteger(value)?`${value} ${unit}`:void 0;let rate=maybeRate(duration.toDays({integral:!1}),"days");return rate===void 0&&(rate=maybeRate(duration.toHours({integral:!1}),"hours")),rate===void 0&&(rate=maybeRate(duration.toMinutes({integral:!0}),"minutes")),new Schedule(`rate(${rate})`)}static cron(options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_stepfunctions_tasks_CronOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.cron),error}if(options.weekDay!==void 0&&options.day!==void 0)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`CannotSupplyDayWeekDay`,"Cannot supply both 'day' and 'weekDay', use at most one");const minute=options.minute??"*",hour=options.hour??"*",month=options.month??"*",day=options.day??(options.weekDay!==void 0?"?":"*"),weekDay=options.weekDay??"?",year=options.year??"*";return new Schedule(`cron(${minute} ${hour} ${day} ${month} ${weekDay} ${year})`)}constructor(expressionString){this.expressionString=expressionString}}exports.Schedule=Schedule;
