/*
 * 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-tsx-ojattr-enum-deprecated";const LONG="Web component attributes that are assigned a deprecated enumerated value should not be used.";const SHORT="Deprecated enumerated attribute values should not be used.";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";const JET_RELS=2;const SEV_BLOCKER="blocker";const MSG_ID_AGED="_aged";const MSG_ID_USER="_user";const OJ_DYNAMIC="oj-dynamic";const OJ_DYN="oj-dyn";function getName(){return RULE_NAME};function getShortDescription(){return SHORT};function getDescription(){return LONG};function register(){return{"TsxWebComponent":_onWc}};function _onWc(ruleCtx,tsxComp){var props,tsxProp,propName,val,enumValue,issue,metaLib,o,since,help;metaLib=ruleCtx.utils.metaLib;if(!(props=tsxComp.properties)){return}let tag=tsxComp.name;for(let i=0;i<props.length;i++){issue=null;tsxProp=props[i];if(!(propName=tsxProp.name)||tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){continue}if(!(val=tsxProp.node.value)){continue}if(val.type==="Literal"){enumValue=val.value}else{continue;let obj;if(obj=ruleCtx.utils.tsxUtils.getExpressionObject(tsxProp)){var jj=42}}if(propName.startsWith("data-")||propName.startsWith("aria-")||propName==="class"||propName==="style"){continue}if(o=metaLib.isTagAttrEnumValueDeprecated(tsxComp.name,propName,enumValue)){help=o.description?" "+o.description.trim():"";since=o.since?" (since "+o.since+")":"";issue=new ruleCtx.Issue(`<${tsxComp.name}> property '${propName}' enumerated value '${enumValue}' is deprecated${since}.${help}`);ruleCtx.utils.tsxUtils.setIssuePropValuePosition(issue,tsxProp);if(metaLib.isJetTag(tag)||tag===OJ_DYNAMIC||tag===OJ_DYN){if(o.since&&ruleCtx.utils.jafLib.getMajorReleaseCount(o.since)>JET_RELS){issue.setSeverity(SEV_BLOCKER);issue.setMsgKey(RULE_NAME+MSG_ID_AGED)}}else{issue.setMsgKey(RULE_NAME+MSG_ID_USER)}ruleCtx.reporter.addIssue(issue,ruleCtx)}}};module.exports={getName,getDescription,getShortDescription,register};