/*
 * 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 hasProp=require("./helpers/tsx/has-prop-value");const RULENAME="oj-tsx-bp-button-xs-chroming";const DESCRIPTION="For components <oj-button> and <oj-c-button>, property size=\"xs\" is only supported using "+"ghost chroming and icon display mode. For size=\"xs\":<br>"+"&nbsp; 1) chroming=\"ghost\" is required, and:<br>"+"&nbsp; 2) display=\"icons\" is required.<br>";const SHORT_DESCRIPTION="For <oj-button> and <oj-c-button> property size=\"xs\" is only supported using "+"ghost chroming and icon display mode.<br>";"short description";const XS="xs";const DISPLAY="display";const CHROMING="chroming";const GHOST="ghost";const ICONS="icons";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-c-button size=>":this._onBtn,"Tsx<oj-c-menu-button size=>":this._onBtn}}_onBtn(ruleCtx,tsxProp){var size;if(!(size=this._tsxUtils.getPropertyStringValue(tsxProp))){return}if(size===XS){let msgType=0;let tsxComp=tsxProp.parent;if(hasProp(tsxComp,CHROMING,GHOST)){if(hasProp(tsxComp,DISPLAY,ICONS)){return}msgType=2}else{msgType=1}if(msgType){this._emitIssue(ruleCtx,tsxComp.name,msgType)}}}_emitIssue(ruleCtx,tag,msgType){var msg,tag;if(msgType===1){msg=`<${tag} size="xs"> requires chroming="ghost".`}else if(msgType===2){msg=`<${tag} size="xs"> requires 'display="icons".`}if(msg){let issue=new ruleCtx.Issue(msg);let attrPos=ruleCtx.position;issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;