'use strict';
import { withIdProps } from '../../../../fd-toolbox-core/types/resource-with-id.js';
import { oDataLogicalOperationTypes, oDataComparisonTypes, oDataFilterTypes } from '../../../../fd-toolbox/odata/odata-enums.js';
import { createError } from '../../../../fd-toolbox/errors/errors.js';
import { toolboxErrorMessages } from '../../../../fd-toolbox/constants/toolbox-error-messages-constants.js';
import { getOData } from '../repositories/odata-db.js';
import { fillOdataConfigForMany } from '../api/odata/odata-metas.js';
import { firstOrUndefined } from '../../../../fd-toolbox/server/collections/single-funcs.js';

var __defProp=Object['defineProperty'],__name=(_0x4e718c,_0x1cf4fd)=>__defProp(_0x4e718c,'name',{'value':_0x1cf4fd,'configurable':!![]});async function getResourceByIdWithConfig(_0x145911,_0x42a043,_0x515ba0,_0x8aad33,_0x15ddef,_0x408822){await fillOdataConfigForMany(_0x145911,_0x515ba0);const _0x38c52d={'type':oDataFilterTypes['default'],'comparisonType':oDataComparisonTypes['equal'],'leftSide':withIdProps['id'],'rightSide':_0x42a043['toString'](),'logicalOperationType':oDataLogicalOperationTypes['and']};_0x515ba0['filters']['push'](_0x38c52d);let _0x3aa88c=_0x408822?await _0x408822(_0x42a043,_0x515ba0):firstOrUndefined(await getOData(_0x145911['resourceName'],_0x145911['orderBys'],_0x515ba0));if(_0x8aad33&&_0x3aa88c===void(0x5*-0x3d7+-0x1fd8+0x330b))throw createError(toolboxErrorMessages['resourceNotFound']['replace']('{0}',_0x15ddef['name'])['replace']('{1}',_0x42a043['toString']()));return _0x3aa88c;}__name(getResourceByIdWithConfig,'getResourceByIdWithConfig');

export { getResourceByIdWithConfig };
