/*
 * 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 helperPos=require("./helpers/json-propname-pos");const helperProp=require("./helpers/bp-checkPropType");const RULE_NAME="oj-cca-compjson-bp-ar";function getName(){return RULE_NAME};function getShortDescription(){return"Web component component.json metadata should follow best practices and avoid 'array' properties"};function getDescription(){return"For best practices, web component property definitions should avoid use of unqualified property type 'array', and provide a more complete definition of the API using a closure type definition"};function register(){return{"compjson-composite":_handle}};function _handle(ruleCtx,obj){var json,props,prop,propObj,propType,issue,msg,pos,i;json=obj.obj;if(json.properties){props=helperProp(json.properties,"a");if(props){for(i=0;i<props.length;i++){prop=props[i];propObj=prop.includes(".")?_getPropObject(json.properties,prop):json.properties[prop];propType=propObj.type;if(propType.indexOf("<")>=0){continue}msg="property '"+prop+"': unqualified type 'array'. Provide a more complete API definition using a closure type definition";issue=new ruleCtx.Issue(msg);pos=helperPos(ruleCtx,prop);issue.setPosition(pos.row,pos.col,pos.index,pos.index?pos.index+6:0);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}};function _getPropObject(properties,propName){var propObj,a,i;a=propName.split(".");for(i=0;i<a.length;i++){propObj=properties[a[i]];if(propObj.properties){properties=propObj.properties}}return propObj}module.exports={getName,getDescription,getShortDescription,register};