"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.FairshareSchedulingPolicy=exports.SchedulingPolicyBase=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),batch_generated_1=require("./batch.generated"),core_1=require("../../core");class SchedulingPolicyBase extends core_1.Resource{constructor(scope,id,props){super(scope,id,{physicalName:props?.schedulingPolicyName})}}exports.SchedulingPolicyBase=SchedulingPolicyBase;class FairshareSchedulingPolicy extends SchedulingPolicyBase{static fromFairshareSchedulingPolicyArn(scope,id,fairshareSchedulingPolicyArn){const stack=core_1.Stack.of(scope);class Import extends SchedulingPolicyBase{constructor(){super(...arguments),this.schedulingPolicyArn=fairshareSchedulingPolicyArn,this.schedulingPolicyName=stack.splitArn(fairshareSchedulingPolicyArn,core_1.ArnFormat.SLASH_RESOURCE_NAME).resourceName,this.shares=[]}}return new Import(scope,id)}constructor(scope,id,props){super(scope,id,props);try{jsiiDeprecationWarnings.aws_cdk_lib_aws_batch_FairshareSchedulingPolicyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,FairshareSchedulingPolicy),error}this.computeReservation=props?.computeReservation,this.shareDecay=props?.shareDecay,this.shares=props?.shares??[];const resource=new batch_generated_1.CfnSchedulingPolicy(this,"Resource",{fairsharePolicy:{computeReservation:this.computeReservation,shareDecaySeconds:this.shareDecay?.toSeconds(),shareDistribution:core_1.Lazy.any({produce:()=>this.shares?.map(share=>({shareIdentifier:share.shareIdentifier,weightFactor:share.weightFactor}))})},name:props?.schedulingPolicyName});this.schedulingPolicyArn=this.getResourceArnAttribute(resource.attrArn,{service:"batch",resource:"scheduling-policy",resourceName:this.physicalName}),this.schedulingPolicyName=this.getResourceNameAttribute(resource.ref)}addShare(share){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_batch_Share(share)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addShare),error}this.shares.push(share)}}exports.FairshareSchedulingPolicy=FairshareSchedulingPolicy,_a=JSII_RTTI_SYMBOL_1,FairshareSchedulingPolicy[_a]={fqn:"aws-cdk-lib.aws_batch.FairshareSchedulingPolicy",version:"2.96.1"};
