"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlanAddons = exports.Plans = void 0;
const utils_js_1 = require("./utils.cjs");
/**
 * Plans
 * Manage customer subscription plans and addon assignments.
 */
class Plans {
    client;
    addons;
    constructor(client) {
        this.client = client;
        this.addons = new PlanAddons(this.client);
    }
    /**
     * Create a plan
     * @param plan - The plan to create
     * @param options - Optional request options
     * @returns The created plan
     */
    async create(plan, options) {
        const resp = await this.client.POST('/api/v1/plans', {
            body: plan,
            ...options,
        });
        return (0, utils_js_1.transformResponse)(resp);
    }
    /**
     * Get a plan by ID
     * @param planId - The ID of the plan to retrieve
     * @param params - Optional query parameters
     * @param options - Optional request options
     * @returns The plan
     */
    async get(planId, params, options) {
        const resp = await this.client.GET('/api/v1/plans/{planId}', {
            params: {
                path: { planId },
                query: params,
            },
            ...options,
        });
        return (0, utils_js_1.transformResponse)(resp);
    }
    /**
     * List plans
     * @param params - Optional parameters for listing plans
     * @param options - Optional request options
     * @returns A list of plans
     */
    async list(params, options) {
        const resp = await this.client.GET('/api/v1/plans', {
            params: { query: params },
            ...options,
        });
        return (0, utils_js_1.transformResponse)(resp);
    }
    /**
     * Update a plan
     * @param planId - The ID of the plan to update
     * @param plan - The plan data to update
     * @param options - Optional request options
     * @returns The updated plan
     */
    async update(planId, plan, options) {
        const resp = await this.client.PUT('/api/v1/plans/{planId}', {
            body: plan,
            params: { path: { planId } },
            ...options,
        });
        return (0, utils_js_1.transformResponse)(resp);
    }
    /**
     * Delete a plan by ID
     * @param planId - The ID of the plan to delete
     * @param options - Optional request options
     * @returns void or standard error response structure
     */
    async delete(planId, options) {
        const resp = await this.client.DELETE('/api/v1/plans/{planId}', {
            params: { path: { planId } },
            ...options,
        });
        return (0, utils_js_1.transformResponse)(resp);
    }
    /**
     * Archive a plan
     * @param planId - The ID of the plan to archive
     * @param options - Optional request options
     * @returns The archived plan
     */
    async archive(planId, options) {
        const resp = await this.client.POST('/api/v1/plans/{planId}/archive', {
            params: { path: { planId } },
            ...options,
        });
        return (0, utils_js_1.transformResponse)(resp);
    }
    /**
     * Publish a plan
     * @param planId - The ID of the plan to publish
     * @param options - Optional request options
     * @returns The published plan
     */
    async publish(planId, options) {
        const resp = await this.client.POST('/api/v1/plans/{planId}/publish', {
            params: { path: { planId } },
            ...options,
        });
        return (0, utils_js_1.transformResponse)(resp);
    }
}
exports.Plans = Plans;
/**
 * Plan Addons
 * Manage addon assignments for plans.
 */
class PlanAddons {
    client;
    constructor(client) {
        this.client = client;
    }
    /**
     * List plan addons
     * @param planId - The ID of the plan
     * @param params - Optional query parameters
     * @param options - Optional request options
     * @returns A list of plan addons
     */
    async list(planId, params, options) {
        const resp = await this.client.GET('/api/v1/plans/{planId}/addons', {
            params: {
                path: { planId },
                query: params,
            },
            ...options,
        });
        return (0, utils_js_1.transformResponse)(resp);
    }
    /**
     * Create a plan addon
     * @param planId - The ID of the plan
     * @param planAddon - The plan addon to create
     * @param options - Optional request options
     * @returns The created plan addon
     */
    async create(planId, planAddon, options) {
        const resp = await this.client.POST('/api/v1/plans/{planId}/addons', {
            body: planAddon,
            params: { path: { planId } },
            ...options,
        });
        return (0, utils_js_1.transformResponse)(resp);
    }
    /**
     * Get a plan addon by ID
     * @param planId - The ID of the plan
     * @param planAddonId - The ID of the plan addon
     * @param options - Optional request options
     * @returns The plan addon
     */
    async get(planId, planAddonId, options) {
        const resp = await this.client.GET('/api/v1/plans/{planId}/addons/{planAddonId}', {
            params: {
                path: { planAddonId, planId },
            },
            ...options,
        });
        return (0, utils_js_1.transformResponse)(resp);
    }
    /**
     * Update a plan addon
     * @param planId - The ID of the plan
     * @param planAddonId - The ID of the plan addon to update
     * @param planAddon - The plan addon data to update
     * @param options - Optional request options
     * @returns The updated plan addon
     */
    async update(planId, planAddonId, planAddon, options) {
        const resp = await this.client.PUT('/api/v1/plans/{planId}/addons/{planAddonId}', {
            body: planAddon,
            params: { path: { planAddonId, planId } },
            ...options,
        });
        return (0, utils_js_1.transformResponse)(resp);
    }
    /**
     * Delete a plan addon by ID
     * @param planId - The ID of the plan
     * @param planAddonId - The ID of the plan addon to delete
     * @param options - Optional request options
     * @returns void or standard error response structure
     */
    async delete(planId, planAddonId, options) {
        const resp = await this.client.DELETE('/api/v1/plans/{planId}/addons/{planAddonId}', {
            params: { path: { planAddonId, planId } },
            ...options,
        });
        return (0, utils_js_1.transformResponse)(resp);
    }
}
exports.PlanAddons = PlanAddons;
//# sourceMappingURL=plans.cjs.map