'use strict';
import { apiGetWithOData } from '../../../fd-toolbox/api/api-client.js';
import { apiPathNames } from '../../../fd-toolbox/api/api-path-names.js';
import { getODataBuilder } from '../../../fd-toolbox/odata/odata-builder-funcs.js';
import { oDataOperators } from '../../../fd-toolbox/enums/enums.js';
import { subscriptionStatuses } from '../core/resources/enums/payment-enums.js';
import { oDataFilterTypes, oDataLogicalOperationTypes } from '../../../fd-toolbox/odata/odata-enums.js';
import { subscriptionProps } from './subscription-props.js';
import { singleOrUndefined } from '../../../fd-toolbox/server/collections/single-funcs.js';

var __defProp=Object['defineProperty'],__name=(_0x48f1ad,_0x595f17)=>__defProp(_0x48f1ad,'name',{'value':_0x595f17,'configurable':!![]});async function fetchActiveOrTrialSubscription(){const _0x4a7374=getActiveOrTrialSubscriptionODataConfig(),{data:_0x4fd57a=[]}=await apiGetWithOData(apiPathNames['subscription'],_0x4a7374);return singleOrUndefined(_0x4fd57a);}__name(fetchActiveOrTrialSubscription,'fetchActiveOrTrialSubscription');function getActiveOrTrialSubscriptionODataConfig(){const _0x58e3e4=getODataBuilder();return _0x58e3e4['expand'](subscriptionProps['pricing']),_0x58e3e4['filter'](subscriptionProps['status'],subscriptionStatuses['active'],oDataOperators['equal'],{'comparisonType':oDataFilterTypes['number']}),_0x58e3e4['filter'](subscriptionProps['status'],subscriptionStatuses['trialing'],oDataOperators['equal'],{'type':oDataFilterTypes['number'],'logicalOperationType':oDataLogicalOperationTypes['or']}),_0x58e3e4['build']();}__name(getActiveOrTrialSubscriptionODataConfig,'getActiveOrTrialSubscriptionODataConfig');

export { fetchActiveOrTrialSubscription };
