/*
 * 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 RULE_NAME="oj-html-jq-databind";const OJ_PREFIX="oj.";function getName(){return RULE_NAME};function getShortDescription(){return"Discontinue instantiation of JET JQUI components using 'data-bind'"};function getDescription(){return"Discontinue instantiation of JET JQUI components using '<i>data-bind</i>'. For example, in place of <i>oj.ojButton</i>, use JET custom component syntax <i><oj-button></i>."};function register(){return{"<data-bind=>":_onDataBind}};function _onDataBind(ruleCtx,attrName,attrValue){var issue,componentName,status,suggestion,since,ojElem,fullClass,msg;if(attrValue.indexOf("ojComponent")<0){return}componentName=ruleCtx.utils.DomUtils.extractComponentFromDataBind(attrValue);fullClass=OJ_PREFIX+componentName;if(componentName){if(status=ruleCtx.utils.metaLib.isClassDeprecated(fullClass)){suggestion=status[0].description;since=status[0].since;since=since?"(since"+since+") ":""}}if(componentName){ojElem=ruleCtx.utils.metaLib.getTagFromClass(fullClass);msg="JQUI data-bind instantiation of "+componentName+" found in <"+ruleCtx.tag+">";if(ojElem){if(ojElem==="oj-tree"){ojElem="oj-tree-view"}msg+=".  Use <"+ojElem+">."}issue=new ruleCtx.Issue(msg);issue.setMsgKey(RULE_NAME+"_1")}else{issue=new ruleCtx.Issue(`JQUI data-bind invocation of unknown JET component found in <${ruleCtx.tag}>`);issue.setMsgKey(RULE_NAME+"_2")}if(issue){ruleCtx.reporter.addIssue(issue,ruleCtx)}if(suggestion){issue=new ruleCtx.Issue(`JQUI data-bind invocation for deprecated ${since}JET component '${componentName}'. ${suggestion}`);issue.setMsgKey(RULE_NAME+"_3");ruleCtx.reporter.addIssue(issue,ruleCtx)}};module.exports={getName,getDescription,getShortDescription,register};