/*
 * Copyright (c) 2018, 2026, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 */
const VC=require("./jetwco-cacc-auditConstraints");function controlCallback(controlRuleName,controlRuleDef,semver,cacheManager,metadata,compareMetadata,componentVersionDiff,baselines,componentType,componentName,errorMsgContext,overrideTypeMappings){let errorCondition;if(componentType==="composite"){const{add:addConstraint,remove:removeConstraint,mutate:mutateConstraint}=controlRuleDef;let flagDiff,errorState;if(metadata.hasOwnProperty("dynamicSlots")){if(!compareMetadata.hasOwnProperty("dynamicSlots")){flagDiff="added to";switch(addConstraint){case VC.NEVER:errorState=true;break;case VC.PATCH:if(componentVersionDiff<2){errorState=true}break;case VC.SEMVER:case VC.MINOR:if(componentVersionDiff<3){errorState=true}break;default:if(componentVersionDiff<4){errorState=true}break}}}else if(compareMetadata.hasOwnProperty("dynamicSlots")){flagDiff="removed from";let errorState=false;switch(removeConstraint){case VC.NEVER:errorState=true;break;default:if(componentVersionDiff<4){errorState=true}break}}if(errorState){errorCondition=`dynamicSlots marker ${flagDiff}${errorMsgContext}'${removeConstraint}'`}}return errorCondition};module.exports=controlCallback;