/*
 * 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 RULE_NAME="oj-html-bindforeach-data";const SHORT_DESCRIPT="The 'data' attribute of an <oj-bind-for-each> must be a '[[...]]' expression";const LONG_DESCRIPT="The 'data' attribute of an <oj-bind-for-each> tag must be a '[[...]]' expression and not a literal.";const ATTRNAME="data";const PREFIX_ATTRNAME=":data";const PREFERRED="preferred";const EXPECTED="expected";const MSG="<oj-bind-for-each> 'data' attribute : read-only '[[...]]' expression ";var what;function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCRIPT};function getDescription(){return LONG_DESCRIPT};function register(){return{"<oj-bind-for-each>":_fnTag}};function _fnTag(ruleCtx){var attribs,val,valType,attrName,attrPos,issue;if(ruleCtx.tagNode.attribs){attribs=ruleCtx.tagNode.attribs;val=attribs[ATTRNAME];valType=typeof val;if(valType!=="undefined"){attrName=ATTRNAME}else{val=attribs[PREFIX_ATTRNAME];valType=typeof val;if(valType!=="undefined"){attrName=PREFIX_ATTRNAME}}if(valType==="undefined"){issue=new ruleCtx.Issue("<oj-bind-for-each> 'data' attribute missing");ruleCtx.reporter.addIssue(issue,ruleCtx);return}if(valType==="string"&&val.startsWith("[[")){return}what=valType==="string"&&val.startsWith("{{")?PREFERRED:EXPECTED;issue=new ruleCtx.Issue(MSG+what);attrPos=ruleCtx.utils.DomUtils.getAttribPosition(ruleCtx.data,ruleCtx.tagNode,attrName);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);if(what===PREFERRED){issue.setSeverity("minor")}ruleCtx.reporter.addIssue(issue,ruleCtx)}};module.exports={getName,getDescription,getShortDescription,register};