'use strict';
import { createEslintRule } from '@flint/infra/create-eslint-rule';
import { isMemberExpression, isIdentifier, isCallExpression } from '@flint/infra/analysis';
import { eslintRuleSyntax } from '@flint/infra/constants/eslint-rule-syntax';
import { collectionMethodNames } from '../../../base-repo/constants/internal-common-strings.js';

var __defProp=Object['defineProperty'],__name=(_0x54482d,_0x3d16e8)=>__defProp(_0x54482d,'name',{'value':_0x3d16e8,'configurable':!![]});const ruleName='must-use-odata-builder';const ruleContent='\x0a###\x20Must\x20use\x20getODataBuilder\x20instead\x20of\x20creating\x20oDataConfig\x20manually\x0a\x0a####\x20Wrong\x0a\x0aconst\x20oDataConfig\x20=\x20getEmptyODataConfig();\x0aoDataConfig.filters?.push({\x0a\x20\x20\x20\x20leftHand:\x20\x22userId\x22,\x0a\x20\x20\x20\x20rightHand:\x20userId,\x0a\x20\x20\x20\x20type:\x20oDataFilterTypes.guid,\x0a\x20\x20\x20\x20operator:\x20oDataOperatorConst.equal,\x0a});\x0a\x0a####\x20Correct\x0a\x0aconst\x20oDataConfig\x20=\x20getODataBuilder().filter(\x22userId\x22,\x20userId,\x20oDataOperatorConst.equal).build();\x0a\x0a####\x20Why\x0a\x0aUsing\x20ODataBuilder\x20provides\x20a\x20standardized\x20approach\x20for\x20creating\x20OData\x20queries,\x20reducing\x20errors,\x20improving\x20readability,\x20and\x20ensuring\x20consistent\x20filter\x20construction\x20throughout\x20the\x20codebase.';var mustUseOdataBuilder = createEslintRule(ruleName,ruleContent,__name(function create(_0x231f1a){const _0x32ee6e=new Map(),_0x30a1f1=new Set();return {'VariableDeclarator'(_0x3b1c26){if(!isIdentifier(_0x3b1c26['id']))return;const _0x531b50=_0x3b1c26['init'];if(!_0x531b50||!isCallExpression(_0x531b50))return;const _0x23a3cd=_0x531b50['callee'];if(!isIdentifier(_0x23a3cd)||_0x23a3cd['name']!=='getEmptyODataConfig')return;_0x32ee6e['set'](_0x3b1c26['id']['name'],_0x3b1c26);},'CallExpression'(_0x598432){if(!isMemberExpression(_0x598432['callee']))return;const _0x3103d6=_0x598432['callee']['object'];if(!isMemberExpression(_0x3103d6))return;const _0x33ae0d=_0x3103d6['object'],_0x10f145=_0x3103d6['property'];if(!isIdentifier(_0x33ae0d)||!isIdentifier(_0x10f145))return;_0x32ee6e['has'](_0x33ae0d['name'])&&_0x10f145['name']==='filters'&&isIdentifier(_0x598432['callee']['property'])&&_0x598432['callee']['property']['name']===collectionMethodNames['push']&&(_0x30a1f1['add'](_0x33ae0d['name']),_0x231f1a['report']({'node':_0x598432,'messageId':ruleName}));},[eslintRuleSyntax['programExitSelector']](){for(const [_0x331b4c,_0xef7c95]of _0x32ee6e){!_0x30a1f1['has'](_0x331b4c)&&_0x231f1a['report']({'node':_0xef7c95,'messageId':ruleName});}}};},'create'));

export { mustUseOdataBuilder as default, ruleName };
