/*
 * 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 Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-component-displayname"};ruleDef.prototype.getShortDescription=function(){return"Check component has display name defined"};ruleDef.prototype.getDescription=function(){return"This rule checks that the component has a display name supplied to make the user experience in Visual Builder and Exchange as useful as possible"};ruleDef.prototype.register=function(context){if(context.rulePack.isRuleEnabled("oj-cca-compjson-bp-dsplyname","JET")){return false}else{return{compjson:this._doAudit,Program:this._doVComponentAudit}}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){this._checkDisplayName(context,context.suppData.obj)}};ruleDef.prototype._checkDisplayName=function(context,meta){let issue;if(!meta.hasOwnProperty("displayName")||meta.displayName===undefined||meta.displayName.length===0){issue=new context.Issue(`displayName for component should be defined`);context.reporter.addIssue(issue,context)}};ruleDef.prototype._doVComponentAudit=function(context){const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo){this._checkDisplayName(context,componentInfo)}};module.exports=ruleDef;