'use strict';
import { oDataOperators } from '../enums/enums.js';
import { createODataConfig } from './odataconfig.js';
import { createError } from '../errors/errors.js';
import { odataErrors } from './odata-constants.js';

var __defProp=Object['defineProperty'],__name=(_0x239423,_0x5d7a08)=>__defProp(_0x239423,'name',{'value':_0x5d7a08,'configurable':!![]});const odataConstants={'defaultOrderByPriority':0x1};class ODataBuilder{static{__name(this,'ODataBuilder');}#state;#defaultOrderByPriority;constructor(_0xb59ba0){this.#state=_0xb59ba0??createODataConfig(),this.#defaultOrderByPriority=odataConstants['defaultOrderByPriority'];}['filter'](_0x530756,_0x3f547f,_0x53921c,_0x3daae9){const _0x27e5ce=_0x53921c??oDataOperators['equal'];return this.#state['filters']=this.#state['filters']??[],this.#state['filters']['push']({'leftSide':_0x530756,'rightSide':_0x3f547f,..._0x3daae9,'operator':_0x27e5ce}),this;}['filterString'](_0x39cb6d,_0x51fb8e,_0x11e7e5,_0x3d08c9){return this['filter'](_0x39cb6d,_0x51fb8e,_0x11e7e5,_0x3d08c9);}['filterUuid'](_0xb8ca15,_0xa277fb,_0x32c51d,_0x22020f){return this['filter'](_0xb8ca15,'guid\x27'+_0xa277fb+'\x27',_0x32c51d,_0x22020f);}['selectMany'](_0x1ab19a){return this.#state['selects']=[...this.#state['selects']??[],...Object['values'](_0x1ab19a)['flat']()],this;}['selectArray'](_0x499226){return this.#state['selects']=[...this.#state['selects']??[],..._0x499226],this;}['select'](_0x1c7d83){if(!_0x1c7d83)throw createError(odataErrors['valueIsNull']);return !this.#state['selects']&&(this.#state['selects']=[]),!this.#state['selects']['includes'](_0x1c7d83)&&this.#state['selects']['push'](_0x1c7d83),this;}['expandMany'](_0x32777e){return this.#state['expands']=[...this.#state['expands']??[],..._0x32777e],this;}['expand'](_0x56c549){if(!_0x56c549)throw createError(odataErrors['valueIsNull']);return !this.#state['expands']&&(this.#state['expands']=[]),this.#state['expands']['push'](_0x56c549),this;}['orderBy'](_0x3d2db1,_0x4bb7ae,_0x1b2b0f){return !this.#state['orderBys']&&(this.#state['orderBys']=[]),this.#state['orderBys']['push']({'propertyName':_0x3d2db1,'direction':_0x4bb7ae,'priority':_0x1b2b0f??this.#defaultOrderByPriority}),this;}['top'](_0x4d85c3){if(_0x4d85c3<0x162+0x210*-0x5+0x8ee)throw createError(odataErrors['valueIsNegative']);return this.#state['top']=_0x4d85c3,this;}['skip'](_0x3d2261){if(_0x3d2261<-0x17dc+0x1*-0xe3e+0x261a*0x1)throw createError(odataErrors['valueIsNegative']);return this.#state['skip']=_0x3d2261,this;}['count'](){return this.#state['count']=!![],this;}['build'](){return {...this.#state,'filters':this.#state['filters']??[],'expands':this.#state['expands']??[],'orderBys':this.#state['orderBys']??[],'selects':this.#state['selects']??[]};}}

export { ODataBuilder, odataConstants };
