'use strict';
import { createEslintRule } from '@flint/infra/create-eslint-rule';
import { isIdentifier, isMemberExpression } from '@flint/infra/analysis';
import { jsBasicTypes } from '../../../base-repo/constants/basic-types.js';
import { firstOrUndefined } from '../../../fd-toolbox/server/collections/single-funcs.js';

var __defProp=Object['defineProperty'],__name=(_0x1e60bc,_0x2df753)=>__defProp(_0x1e60bc,'name',{'value':_0x2df753,'configurable':!![]});const ruleName='must-use-only-crud-operations';const ruleContent='\x0a###\x20Must\x20use\x20only\x20CRUD\x20operations\x20for\x20working\x20with\x20resources.\x0a\x0a####\x20Wrong\x0a\x0aawait\x20createResource(foo);\x0a\x0aawait\x20bar.createResource(foo);\x0a\x0a####\x20Correct\x0a\x0aawait\x20crudCreate(foo);\x0a\x0a####\x20Why\x0a\x0aUsing\x20CRUD\x20operations\x20helps\x20maintain\x20clean\x20architecture,\x20improves\x20readability,\x20and\x20simplifies\x20code\x20understanding\x20and\x20extension.',createResource='createResource';var mustUseOnlyCrudOperations = createEslintRule(ruleName,ruleContent,__name(function create(_0x657dbe){const _0x50b746=firstOrUndefined(_0x657dbe['options'])??{'restrictedFunctions':[createResource]},_0x325bf0=_0x50b746['restrictedFunctions'];return {'CallExpression'(_0x87a6a8){const _0x1f944f=_0x87a6a8['callee'];let _0x445c8b;if(isIdentifier(_0x1f944f))_0x445c8b=_0x1f944f['name'];else isMemberExpression(_0x1f944f)&&isIdentifier(_0x1f944f['property'])&&(_0x445c8b=_0x1f944f['property']['name']);_0x445c8b!==void(-0x16cf+-0x38b*0x1+-0x1*-0x1a5a)&&_0x325bf0['includes'](_0x445c8b)&&_0x657dbe['report']({'node':_0x87a6a8,'messageId':ruleName});}};},'create'),{'schema':[{'type':jsBasicTypes['object'],'properties':{'restrictedFunctions':{'type':jsBasicTypes['array'],'items':{'type':jsBasicTypes['string']}}},'additionalProperties':![]}],'defaultOptions':[{'restrictedFunctions':[createResource]}]});

export { mustUseOnlyCrudOperations as default, ruleName };
