/*
 * Copyright (c) 2018, 2025, 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 path=require("path");const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-dynamic-slots-naming"};ruleDef.prototype.getShortDescription=function(){return"Verify dynamic slots are named correctly"};ruleDef.prototype.getDescription=function(){return"This rule checks that any dynamic slot contexts have the correct naming convention"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){const meta=context.suppData.obj;const fullName=Utils.getComponentFullName(meta);const componentType=Utils.getComponentType(meta);if(componentType==="composite"){if(meta.dynamicSlots){Object.keys(meta.dynamicSlots).forEach(ctxName=>{if(!ctxName.endsWith("Context")){const issue=new context.Issue(`Component ${fullName} dynamicSlot ${ctxName} is not named according to the standards with a Context suffix`);context.reporter.addIssue(issue,context)}})}}}};module.exports=ruleDef;