/*
 * 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){let errorConditions=[];if(componentType==="composite"){const{add:addConstraint,remove:removeConstraint}=controlRuleDef;const diffs=CaccHelpers.mapAttributesDiff(metadata.properties,compareMetadata.properties,"writeback",true);if(CaccHelpers.checkConstraintPatchMajor(diffs.add,addConstraint,componentVersionDiff)){errorConditions.push(`Property writeback value set on ${diffs.add.map(addition=>addition.name).join(", ")} in${errorMsgContext}'${addConstraint}'`)}if(CaccHelpers.checkConstraintMajor(diffs.remove,removeConstraint,componentVersionDiff)){errorConditions.push(`Property writeback value unset from ${diffs.remove.map(removed=>removed.name).join(", ")} in${errorMsgContext}'${removeConstraint}'`)}if(errorConditions.length>0){return errorConditions.join("\n")}}return};module.exports=controlCallback;