import type { ComponentType, ReactNode } from 'react';
import type { z } from 'zod';
import type { AnyBlockRuntimeDefinition, BlockRenderKind } from '../contracts';
import type { BlockManifest } from './manifest';
import type { BlockDesignCapabilityDeclaration } from './designCapabilities';
import type { BlockDesignMetadata } from '@riverbankcms/theme-core/site-styles';
import type { ResolverContext } from './runtime';
import type { ThemeTokens } from './theme';
import type { TransformRegistry } from './transforms';
import type { Theme } from '@riverbankcms/theme-core/schema';
export type BlockRenderOptions = Omit<ResolverContext, 'viewModel'>;
export type RenderOptions = Partial<BlockRenderOptions> & {
    viewModelOverrides?: Record<string, unknown>;
    data?: Record<string, unknown>;
    themeConfig?: Theme;
};
export type SystemBlockRenderer<TContent = Record<string, unknown>> = (content: TContent, options?: RenderOptions) => ReactNode;
export type SystemBlockComponentProps<TContent = Record<string, unknown>> = {
    content: TContent;
    theme?: ThemeTokens;
    themeConfig?: Theme;
    registry?: ResolverContext['registry'];
    transforms?: TransformRegistry;
    viewModelOverrides?: Record<string, unknown>;
    data?: Record<string, unknown>;
    pathBase?: string;
    blockId?: string | null;
    blockKind?: string;
    blockBindings?: Record<string, unknown>;
    editableRouteMetadataFieldIds?: ResolverContext['editableRouteMetadataFieldIds'];
    fragmentRegistry?: ResolverContext['fragmentRegistry'];
};
export type SystemBlockComponent<TContent = Record<string, unknown>> = ComponentType<SystemBlockComponentProps<TContent>>;
export type BlockDataLoader = {
    endpoint: string;
    params: Record<string, unknown>;
    mode?: 'server' | 'client';
    /**
     * Optional guard for whether this loader should execute.
     *
     * This is resolved with the same binding system as params, using:
     * - `content.*` (block content)
     * - `$root.*` (siteId/pageId/previewStage)
     *
     * The loader runs only when the resolved value is exactly boolean `true`.
     */
    when?: unknown;
};
export type SystemBlockDefinition<TContent = Record<string, unknown>, TRuntime extends AnyBlockRuntimeDefinition | undefined = undefined> = {
    manifest: BlockManifest;
    normalizeContent?: (content: unknown) => TContent;
    dataSchemas?: Record<string, z.ZodTypeAny>;
    dataLoaders?: Record<string, BlockDataLoader>;
    designCapability?: BlockDesignCapabilityDeclaration;
    designMetadata?: BlockDesignMetadata;
    runtime?: TRuntime;
};
export type BlockDescriptor = {
    name: string;
    title: string;
    description?: string;
    category?: string;
    contentTypes?: string[];
    tags?: string[];
    icon?: string;
    definition: SystemBlockDefinition<unknown, AnyBlockRuntimeDefinition | undefined>;
    /**
     * Where this block comes from:
     * - 'system': Built-in blocks from @riverbankcms/blocks
     * - 'sdk': Custom blocks from SDK site's riverbank.config.ts
     * - 'database': Custom blocks from site_custom_blocks table
     */
    source?: 'system' | 'sdk' | 'database';
};
export declare function registerBlockDefinition<TContent, TRuntime extends AnyBlockRuntimeDefinition | undefined>(definition: SystemBlockDefinition<TContent, TRuntime>): SystemBlockDefinition<TContent, TRuntime>;
export declare function getBlockDefinition(name: string): SystemBlockDefinition<unknown, AnyBlockRuntimeDefinition | undefined> | undefined;
export declare function hasBlockDefinition(name: string): boolean;
export declare function listBlockDefinitions(): SystemBlockDefinition<unknown, AnyBlockRuntimeDefinition | undefined>[];
export declare function getBlockRenderKind(definition: SystemBlockDefinition<unknown, AnyBlockRuntimeDefinition | undefined>): BlockRenderKind;
export declare function listBlockDescriptors(): BlockDescriptor[];
export declare function clearBlockDefinitions(): void;
