/*
 * 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 CaccHelpers=require("./jetwco-cacc-helpers");function controlCallback(controlRuleName,controlRuleDef,semver,cacheManager,metadata,compareMetadata,componentVersionDiff,baselines,componentType,componentName,errorMsgContext,overrideTypeMappings){if(componentType==="composite"){let errorConditions=[];const{add:addConstraint,remove:removeConstraint,mutate:mutateConstraint}=controlRuleDef;if(metadata.hasOwnProperty("slots")&&compareMetadata.hasOwnProperty("slots")){for(const[slotName,slotDef]of Object.entries(metadata.slots)){if(compareMetadata.slots.hasOwnProperty(slotName)){const compareSlotDef=compareMetadata.slots[slotName];if(slotDef.hasOwnProperty("data")&&compareSlotDef.hasOwnProperty("data")){const diffs=CaccHelpers.mapAttributesDiff(slotDef.data,compareSlotDef.data,"type",false);if(CaccHelpers.checkConstraintMajor(diffs.mutate,mutateConstraint,componentVersionDiff)){errorConditions.push(`Type for data attribute(s) ${diffs.mutate.map(mut=>mut.name).join(", ")} updated for slot ${slotName} in${errorMsgContext}'${addConstraint}'`)}}}}}if(errorConditions.length>0){return errorConditions.join("\n")}}return};module.exports=controlCallback;