"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.JobDefinitionBase=exports.Reason=exports.Action=exports.RetryStrategy=void 0,exports.baseJobDefinitionProperties=baseJobDefinitionProperties;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},helpers_internal_1=()=>{var tmp=require("../../core/lib/helpers-internal");return helpers_internal_1=()=>tmp,tmp};class RetryStrategy{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_batch.RetryStrategy",version:"2.256.1"};static of(action,on){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_Action(action),jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_Reason(on)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.of),error}return new RetryStrategy(action,on)}action;on;constructor(action,on){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_Action(action),jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_Reason(on)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,RetryStrategy),error}this.action=action,this.on=on}}exports.RetryStrategy=RetryStrategy;var Action;(function(Action2){Action2.EXIT="EXIT",Action2.RETRY="RETRY"})(Action||(exports.Action=Action={}));class Reason{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_batch.Reason",version:"2.256.1"};static NON_ZERO_EXIT_CODE={onExitCode:"*"};static CANNOT_PULL_CONTAINER={onReason:"CannotPullContainerError:*"};static SPOT_INSTANCE_RECLAIMED={onStatusReason:"Host EC2*"};static custom(customReasonProps){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_CustomReason(customReasonProps)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.custom),error}return customReasonProps}}exports.Reason=Reason;class JobDefinitionBase extends core_1().Resource{parameters;retryAttempts;schedulingPriority;timeout;skipDeregisterOnUpdate;_retryStrategies;constructor(scope,id,props){super(scope,id,{physicalName:props?.jobDefinitionName}),this.parameters=props?.parameters,this.retryAttempts=props?.retryAttempts,this._retryStrategies=helpers_internal_1().Box.fromArray(props?.retryStrategies??[]),this.schedulingPriority=props?.schedulingPriority,this.timeout=props?.timeout,this.skipDeregisterOnUpdate=props?.skipDeregisterOnUpdate}get jobDefinitionRef(){return{jobDefinitionArn:this.jobDefinitionArn}}get retryStrategies(){return this._retryStrategies.getMutable()}_mapRetryStrategies(fn){return this._retryStrategies.map(fn)}addRetryStrategy(strategy){this._retryStrategies.push(strategy)}}exports.JobDefinitionBase=JobDefinitionBase;function baseJobDefinitionProperties(baseJobDefinition){return{parameters:baseJobDefinition.parameters,retryStrategy:{attempts:baseJobDefinition.retryAttempts,evaluateOnExit:baseJobDefinition._mapRetryStrategies(strategy=>({action:strategy.action,...strategy.on}))},schedulingPriority:baseJobDefinition.schedulingPriority,timeout:{attemptDurationSeconds:baseJobDefinition.timeout?.toSeconds()},type:"dummy",resourceRetentionPolicy:baseJobDefinition.skipDeregisterOnUpdate!==void 0?{skipDeregisterOnUpdate:baseJobDefinition.skipDeregisterOnUpdate}:void 0}}
