"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpenMeter = void 0;
const openapi_fetch_1 = __importStar(require("openapi-fetch"));
const addons_js_1 = require("./addons.cjs");
const apps_js_1 = require("./apps.cjs");
const billing_js_1 = require("./billing.cjs");
const customers_js_1 = require("./customers.cjs");
const debug_js_1 = require("./debug.cjs");
const entitlements_js_1 = require("./entitlements.cjs");
const events_js_1 = require("./events.cjs");
const features_js_1 = require("./features.cjs");
const info_js_1 = require("./info.cjs");
const meters_js_1 = require("./meters.cjs");
const notifications_js_1 = require("./notifications.cjs");
const plans_js_1 = require("./plans.cjs");
const portal_js_1 = require("./portal.cjs");
const subjects_js_1 = require("./subjects.cjs");
const subscription_addons_js_1 = require("./subscription-addons.cjs");
const subscriptions_js_1 = require("./subscriptions.cjs");
const utils_js_1 = require("./utils.cjs");
__exportStar(require("./common.cjs"), exports);
__exportStar(require("./schemas.cjs"), exports);
/**
 * OpenMeter Client
 */
class OpenMeter {
    config;
    client;
    addons;
    apps;
    billing;
    customers;
    debug;
    entitlementsV1;
    entitlements;
    events;
    features;
    info;
    meters;
    notifications;
    plans;
    portal;
    subjects;
    subscriptionAddons;
    subscriptions;
    constructor(config) {
        this.config = config;
        this.client = (0, openapi_fetch_1.default)({
            ...config,
            headers: {
                ...config.headers,
                Authorization: config.apiKey ? `Bearer ${config.apiKey}` : undefined,
            },
            querySerializer: (q) => (0, openapi_fetch_1.createQuerySerializer)({
                array: {
                    explode: true,
                    style: 'form',
                },
                object: {
                    explode: true,
                    style: 'deepObject',
                },
            })((0, utils_js_1.encodeDates)(q)),
        });
        this.addons = new addons_js_1.Addons(this.client);
        this.apps = new apps_js_1.Apps(this.client);
        this.billing = new billing_js_1.Billing(this.client);
        this.customers = new customers_js_1.Customers(this.client);
        this.debug = new debug_js_1.Debug(this.client);
        this.entitlementsV1 = new entitlements_js_1.Entitlements(this.client);
        this.entitlements = new entitlements_js_1.EntitlementsV2(this.client);
        this.events = new events_js_1.Events(this.client);
        this.features = new features_js_1.Features(this.client);
        this.info = new info_js_1.Info(this.client);
        this.meters = new meters_js_1.Meters(this.client);
        this.notifications = new notifications_js_1.Notifications(this.client);
        this.plans = new plans_js_1.Plans(this.client);
        this.portal = new portal_js_1.Portal(this.client);
        this.subjects = new subjects_js_1.Subjects(this.client);
        this.subscriptionAddons = new subscription_addons_js_1.SubscriptionAddons(this.client);
        this.subscriptions = new subscriptions_js_1.Subscriptions(this.client);
    }
}
exports.OpenMeter = OpenMeter;
//# sourceMappingURL=index.cjs.map