import { B as BackendPlugin } from '../../shared/stack.7n9Y_u7N.js';
export { C as ClientPlugin } from '../../shared/stack.7n9Y_u7N.js';
import { Endpoint } from 'better-call';
export { Endpoint, Router, createEndpoint, createRouter } from 'better-call';
export { Adapter, DatabaseDefinition, DbPlugin, createDbPlugin } from '@btst/db';
import '@btst/yar';

/**
 * Plugin utilities and types for building standalone plugins
 *
 * This module exports everything needed to create custom plugins
 * for BTST outside of this package.
 *
 * Note: Backend and Client plugins are separate to prevent SSR issues
 * and enable better code splitting. Import them separately:
 * - Backend: import type { BackendPlugin } from "@btst/stack/plugins/api"
 * - Client: import type { ClientPlugin } from "@btst/stack/plugins/client"
 */

/**
 * Helper to define a backend plugin with full type inference
 *
 * @example
 * ```ts
 * const messagesPlugin = defineBackendPlugin({
 *   name: "messages",
 *   dbPlugin: createDbPlugin("messages", messagesSchema),
 *   routes: (adapter) => ({
 *     list: endpoint("/messages", { method: "GET" }, async () => { ... }),
 *     create: endpoint("/messages", { method: "POST" }, async () => { ... })
 *   })
 * });
 * // Route keys "list" and "create" are preserved in types
 * ```
 *
 * @template TRoutes - The exact shape of routes (auto-inferred from routes function)
 * @template TApi - The shape of the server-side api surface (auto-inferred from api factory)
 */
declare function defineBackendPlugin<TRoutes extends Record<string, Endpoint> = Record<string, Endpoint>, TApi extends Record<string, (...args: any[]) => any> = never>(plugin: BackendPlugin<TRoutes, TApi>): BackendPlugin<TRoutes, TApi>;

export { BackendPlugin, defineBackendPlugin };
