'use strict';
import { oDataOrderByDirections } from '../enums/enums.js';
import { trimCharacter } from '../strings/strings.js';
import { getODataFilterAsString } from './odata-formatting/odata-filters.js';
import { oDataLogicalOperationTypes } from './odata-enums.js';
import { oDataQueryParams } from '../constants/odata-query-params.js';
import { booleanStringValues } from '../../base-repo/constants/type-string-values.js';
import { oDataLogicalOperators } from './odata-filter-constants.js';

var __defProp=Object['defineProperty'],__name=(_0x46b54e,_0x23a35e)=>__defProp(_0x46b54e,'name',{'value':_0x23a35e,'configurable':!![]});function getODataParams(_0x336c2c){let _0x1a72dc=getFilters(_0x336c2c);_0x336c2c['skip']&&_0x1a72dc['push']({'name':oDataQueryParams['skip'],'value':_0x336c2c['skip']['toString']()});_0x336c2c['top']&&_0x1a72dc['push']({'name':oDataQueryParams['top'],'value':_0x336c2c['top']['toString']()});_0x336c2c['count']&&_0x1a72dc['push']({'name':'count','value':booleanStringValues['true']});_0x336c2c['orderBys']&&_0x336c2c['orderBys']['length']>-0x129d+0x1a46+-0x1*0x7a9&&_0x336c2c['orderBys']['forEach'](_0x5c92bc=>{_0x1a72dc['push']({'name':oDataQueryParams['orderBys'],'value':getColumnNameAndDirectionForOrderBy(_0x5c92bc['propertyName'],_0x5c92bc['direction'])});});if(_0x336c2c['selects']?.['length'])configureSelectOData(_0x336c2c,_0x1a72dc);else _0x336c2c['expands']&&configureExpandOData(_0x336c2c,_0x1a72dc);return _0x1a72dc;}__name(getODataParams,'getODataParams');function getFilters(_0x49b7b2){let _0x3e5e50=[];if(_0x49b7b2['filters']&&_0x49b7b2['filters']['length']>-0x1*0xab2+-0x2285+0x2d37*0x1){let _0x42d5f8={'name':oDataQueryParams['filter'],'value':''},_0x3dfb96=_0x49b7b2['filters']['length'];for(let _0x4d321c=-0x1*0x3f3+0x16fd*0x1+-0x130a;_0x4d321c<_0x3dfb96;_0x4d321c++){let _0x1c4937=getODataFilterAsString(_0x49b7b2['filters'][_0x4d321c]);_0x4d321c>-0x1*0x13df+-0x1e34+0x3213?_0x49b7b2['filters'][_0x4d321c]['logicalOperationType']===oDataLogicalOperationTypes['or']?_0x42d5f8['value']+=''+oDataLogicalOperators['or']+_0x1c4937:_0x42d5f8['value']+=''+oDataLogicalOperators['and']+_0x1c4937:_0x42d5f8['value']+=_0x1c4937;}_0x3e5e50['push'](_0x42d5f8);}return _0x3e5e50;}__name(getFilters,'getFilters');function getColumnNameAndDirectionForOrderBy(_0x5508e4,_0x264fae){return _0x5508e4+'\x20'+(_0x264fae===oDataOrderByDirections['desc']?oDataQueryParams['orderByDesc']:oDataQueryParams['orderByAsc']);}__name(getColumnNameAndDirectionForOrderBy,'getColumnNameAndDirectionForOrderBy');function configureExpandOData(_0x145a6f,_0x5c5967){if(_0x145a6f['expands']&&_0x145a6f['expands']['length']>0x17f*-0x5+-0x14b0+-0x1*-0x1c2b){let _0x570d3c='';for(let _0x2fb44d of _0x145a6f['expands']){_0x570d3c+=_0x2fb44d+',';}_0x570d3c=trimCharacter(_0x570d3c,','),_0x5c5967['push']({'name':oDataQueryParams['expand'],'value':_0x570d3c});}}__name(configureExpandOData,'configureExpandOData');function configureSelectOData(_0x3771a5,_0x4bd8d0){if(_0x3771a5['selects']&&_0x3771a5['selects']['length']>0xbe1+0x1*0xf21+-0x1b02){let _0x659074='';for(let _0x4f8038 of _0x3771a5['selects']){_0x659074+=_0x4f8038+',';}_0x659074=trimCharacter(_0x659074,','),_0x4bd8d0['push']({'name':oDataQueryParams['select'],'value':_0x659074});}}__name(configureSelectOData,'configureSelectOData');

export { getODataParams };
