import { ConfigService } from "../../configService/index.mjs";
import { apiMutate } from "../../utilities/useAxiosMutate.mjs";
//#region src/udp/utilities/methodUtils.js
/** @typedef {import('axios').AxiosResponse<any>} AxiosResponse */
const getBaseMethod = (type, baseType, catalogPromotedEntities) => {
	if (!catalogPromotedEntities) return null;
	const entityMethod = catalogPromotedEntities.find((promotedEntity) => {
		const entityNameParts = promotedEntity.entityName.split(".");
		if (entityNameParts.length) return entityNameParts[entityNameParts.length - 1] === type;
		return false;
	});
	return entityMethod ? entityMethod[baseType] : null;
};
/**
* @returns {Promise<AxiosResponse>}
*/
const executeQueryAdHoc = async (data, apiMethodId, urlQueryParams = "") => apiMutate(ConfigService.integrationV1ApiUrl, `apimethod/executeQueryAdHoc/${apiMethodId}${urlQueryParams}`, { method: "post" }, data);
/**
* @returns {Promise<AxiosResponse>}
*/
const executeQueryWithParameters = async (data, apiMethodId, urlQueryParams = "") => apiMutate(ConfigService.integrationV1ApiUrl, `apimethod/executeQueryWithParameters/${apiMethodId}${urlQueryParams}`, { method: "post" }, data);
/**
* @returns {Promise<AxiosResponse>}
*/
const executeQueryInstance = async (data, apiMethodInstanceId, urlQueryParams = "") => apiMutate(ConfigService.integrationV1ApiUrl, `apimethod/executeQueryInstance/${apiMethodInstanceId}${urlQueryParams}`, { method: "post" }, data);
/**
* @returns {Promise<AxiosResponse>}
*/
const executeQueryInstanceWithApiMethodInstance = async (data, urlQueryParams = "") => apiMutate(ConfigService.integrationV1ApiUrl, `apimethod/executeQueryInstance${urlQueryParams}`, { method: "post" }, data);
//#endregion
export { executeQueryAdHoc, executeQueryInstance, executeQueryInstanceWithApiMethodInstance, executeQueryWithParameters, getBaseMethod };

//# sourceMappingURL=methodUtils.mjs.map