/*
 * 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 Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwco-component-cdn"};ruleDef.prototype.getShortDescription=function(){return"Checks to see if relevant components have a CDN location defined"};ruleDef.prototype.getDescription=function(){return"This rule flags any reference or pack components that do not have a CDN path defined"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){let issue;const meta=context.suppData.obj;const componentType=Utils.getComponentType(meta);const componentName=meta.name;switch(componentType){case"pack":case"reference":if(!meta.paths||!meta.paths.cdn||!meta.paths.cdn.hasOwnProperty("min")&&!meta.paths.cdn.hasOwnProperty("debug")){issue=new context.Issue(`${componentType} component ${componentName} does not have a CDN location defined`);context.reporter.addIssue(issue,context)}break;default:break}}};module.exports=ruleDef;