/**
 * API Client for Quickback Compiler Service
 *
 * Handles communication with the remote compiler API.
 */
import type { LoadedConfig } from './file-loader.js';
export interface CompilerInput {
    config: LoadedConfig;
    features: Array<{
        name: string;
        schema: {
            tableName: string;
            columns: any;
            source: string;
        };
        tables?: Array<{
            fileName: string;
            tableName: string;
            source: string;
            hasResourceConfig: boolean;
        }>;
        resourceSource?: string;
        /**
         * One file per action keyed by relative path under the feature dir
         * (e.g. `actions/advance.ts`, `actions/profiles/publish.ts`). Each
         * file is `export default defineAction({...})`. The compiler runs
         * the discovery walker over these to build the action tree.
         */
        actionFiles?: Record<string, string>;
        /**
         * Feature-local helpers under `<feature>/lib/` keyed by relative
         * path (e.g. `lib/inputs.ts`). Copied verbatim into the generated
         * output; action files import them via `../lib/...`.
         */
        featureLibFiles?: Record<string, string>;
    }>;
    /**
     * Project-level shared lib at `quickback/lib/` keyed by relative path
     * (e.g. `lib/inputs.ts`). Aliased as `~/lib/*` in the generated
     * project; cross-feature shared helpers live here.
     */
    projectLib?: Record<string, string>;
    /**
     * Project-level auth hooks at `quickback/hooks/` keyed by relative
     * path (e.g. `hooks/after-user-create.ts`). Wired into Better Auth's
     * `databaseHooks` by the compiler.
     */
    projectHooks?: Record<string, string>;
    /**
     * User-authored Better Auth plugin source files at `quickback/plugins/`
     * keyed by relative path (e.g. `plugins/long-session.ts`). Referenced
     * from `defineAuth("better-auth", { customPlugins: [{ from, export }] })`
     * with a relative `from`. The compiler copies referenced files into
     * the generated output and rewrites the emitted import paths.
     */
    projectPlugins?: Record<string, string>;
    /**
     * Project-level Hono middlewares at `quickback/middlewares/` keyed by
     * relative path (e.g. `middlewares/request-logger.ts`). v0.19+: each
     * file's default export is a Hono middleware handler; the compiler
     * mounts them via `app.use('*', mw)` after platform middleware (auth,
     * db, services) and before route registration. Declarative cross-
     * cutting slot for non-authz concerns.
     */
    projectMiddlewares?: Record<string, string>;
}
export interface GeneratedFile {
    path: string;
    content: string;
    type: string;
    feature?: string;
}
export interface PostCompileCommand {
    description: string;
    command: string;
    optional?: boolean;
    cwd?: 'output' | 'project';
}
export interface CompilerOutput {
    files: GeneratedFile[];
    meta: {
        fileCount: number;
        features: string[];
        timestamp: string;
        version: string;
        timings?: {
            parseMs: number;
            generateMs: number;
            installMs: number;
            commandsMs: number;
            collectMs: number;
            totalMs: number;
            commands: Array<{
                description: string;
                ms: number;
                success: boolean;
            }>;
        };
    };
    commands?: PostCompileCommand[];
    warnings?: string[];
    /**
     * Schema-driven kitchen-sink block to splice into the user's
     * quickback.config.ts. Server-rendered every compile to reflect
     * the current set of options Quickback supports.
     *
     * `block` includes both `// [quickback:options-start]` and
     * `// [quickback:options-end]` sentinels, pre-indented to match
     * the surrounding object literal. `omittedKeys` lists the
     * top-level keys the user has already set, which the server
     * has therefore excluded from the block.
     */
    syncedConfig?: {
        block: string;
        omittedKeys: string[];
    };
}
export interface TemplateInfo {
    name: string;
    description: string;
    tier: 'free' | 'pro';
    preset: string;
    tags: string[];
}
export interface ApiError {
    error: string;
    hint?: string;
    upgrade?: string;
    message?: string;
}
/**
 * Fetch available templates from the server
 */
export declare function fetchTemplates(): Promise<Record<string, TemplateInfo>>;
/**
 * Call the compiler API.
 * Automatically ensures the container is ready before sending the request.
 * Pass `onStatus` to receive progress updates (e.g. for spinner text).
 */
export declare function callCompiler(input: CompilerInput, onStatus?: (message: string) => void): Promise<CompilerOutput>;
/**
 * Check API health
 */
export declare function checkHealth(): Promise<{
    status: string;
    version: string;
}>;
/**
 * Wait for the compiler container to be ready.
 * Cloud containers may need a cold start — this polls health until the
 * container reports "ready", retrying up to `maxAttempts` times.
 */
export declare function waitForReady(maxAttempts?: number, intervalMs?: number, onStatus?: (message: string) => void): Promise<void>;
/**
 * Get the API URL (for debugging)
 */
export declare function getApiUrl(): string;
//# sourceMappingURL=api-client.d.ts.map