/*
 * 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 RULENAME="oj-html-pageopts-type";const DESCRIPTION="Paging Control with numbers is an antipattern in Redwood. Instead the UX recommendation "+"is to use high-water mark scrolling patterns on pages and collections. The JET collections "+"all support high-water mark scrolling natively without the need for a paging control via "+"the scroll-policy attribute. For teams using paging control in Alta we recommend to begin "+"changing the behavior as it will not be supported in Redwood. The only supported use of "+"<oj-paging-control> is to use page-options.type=\"dots\".";const SHORT_DESCRIPTION="Paging Control with numbers is an anti pattern in Redwood";const PAGE_OPTS_TYPE="page-options.type";const DOTS="dots";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{"<oj-paging-control>":this._onPageCtl}}_onPageCtl(ruleCtx){var attrs,attr,found;attrs=ruleCtx.tagNode.attribs;for(attr in attrs){if(attr.startsWith("page-options")){found=true;if(attr.endsWith(".type")){if(ruleCtx.utils.DomUtils.getAttribValue(ruleCtx.tagNode,PAGE_OPTS_TYPE)!==DOTS){this._emit(ruleCtx,true)}break}}}if(!found){this._emit(ruleCtx)}}_emit(ruleCtx,haveAttr){let msg=haveAttr?"page-options.type=numbers is deprecated":"page-options.type omitted and default value 'numbers' is deprecated";let issue=new ruleCtx.Issue(`<oj-paging-control> - ${msg}. Use the scroll property 'loadMoreOnScroll' on the collection.`);if(haveAttr){let pos=ruleCtx.utils.DomUtils.getAttribValuePosition(ruleCtx.data,ruleCtx.tagNode,PAGE_OPTS_TYPE);issue.setPosition(pos);issue.setMsgKey(RULENAME+"_2")}ruleCtx.reporter.addIssue(issue,ruleCtx)}}module.exports=Rule;