import { R as RiverbankClient, P as PageProps, T as Theme, a as ResolvedBlockData, b as RiverbankClientConfig } from './usePage-CyYpOJud.js';
export { d as Page, U as UsePageParams, c as UsePageResult, u as usePage } from './usePage-CyYpOJud.js';
import '@riverbankcms/ai';
import 'zod';
import '@riverbankcms/media-storage-supabase';
import '@riverbankcms/db';
import 'react/jsx-runtime';
import 'react';
import './resolver-BhueZVxZ.js';

/**
 * Server-side helper to fetch content (page or entry) by path.
 *
 * Use this for dynamic routing where a path could resolve to either
 * a page or a content entry.
 */

/**
 * Content entry data returned when a path resolves to an entry
 */
type ContentEntryData = {
    id: string;
    /** Content type key (e.g., 'blog-post', 'product') */
    type: string | null;
    title: string;
    slug: string | null;
    path: string | null;
    status: string;
    publishAt: string | null;
    /** The raw content fields - use these to render your own UI */
    content: Record<string, unknown>;
    metaTitle: string | null;
    metaDescription: string | null;
    createdAt: string;
    updatedAt: string;
};

/**
 * Client-side React hook to fetch content (page or entry) by path.
 *
 * Use this in client components for dynamic routing where a path
 * could resolve to either a page or content entry.
 */

type UseContentParams = {
    client: RiverbankClient;
    siteId: string;
    path: string;
    /**
     * If true, fetches draft/unpublished content instead of published content.
     * This affects both pages and entries.
     * Requires API key with site access.
     *
     * @default false
     */
    preview?: boolean;
};
/**
 * Loading state
 */
type LoadingState = {
    loading: true;
    error: null;
    type: null;
    page: null;
    entry: null;
    theme: null;
    siteId: string;
    resolvedData: null;
};
/**
 * Error state
 */
type ErrorState = {
    loading: false;
    error: Error;
    type: null;
    page: null;
    entry: null;
    theme: null;
    siteId: string;
    resolvedData: null;
};
/**
 * Success state for page content
 */
type PageSuccessState = {
    loading: false;
    error: null;
    type: 'page';
    page: PageProps['page'];
    entry: null;
    theme: Theme;
    siteId: string;
    resolvedData: ResolvedBlockData;
};
/**
 * Success state for entry content
 */
type EntrySuccessState = {
    loading: false;
    error: null;
    type: 'entry';
    page: null;
    entry: ContentEntryData;
    theme: Theme;
    siteId: string;
    resolvedData: null;
};
type UseContentResult = LoadingState | ErrorState | PageSuccessState | EntrySuccessState;
/**
 * Type guard to check if result is loading
 */
declare function isContentLoading(result: UseContentResult): result is LoadingState;
/**
 * Type guard to check if result has an error
 */
declare function isContentError(result: UseContentResult): result is ErrorState;
/**
 * Type guard to check if result is a page
 */
declare function isPageContentResult(result: UseContentResult): result is PageSuccessState;
/**
 * Type guard to check if result is an entry
 */
declare function isEntryContentResult(result: UseContentResult): result is EntrySuccessState;
/**
 * Client-side React hook to fetch content by path.
 *
 * Returns a discriminated union with loading/error states, and either
 * page data (ready for `<Page>` component) or raw entry data (for custom rendering).
 *
 * IMPORTANT: The client object should be stable across renders to avoid
 * unnecessary re-fetches. Create it outside your component or use useMemo.
 *
 * @example Dynamic routing with both pages and entries
 * ```tsx
 * "use client";
 *
 * import { useContent, Page, isPageContentResult } from '@riverbankcms/sdk/client';
 *
 * function DynamicPage({ path }: { path: string }) {
 *   const content = useContent({ client, siteId: 'site-123', path });
 *
 *   if (content.loading) return <div>Loading...</div>;
 *   if (content.error) return <div>Error: {content.error.message}</div>;
 *
 *   if (isPageContentResult(content)) {
 *     return <Page page={content.page} theme={content.theme} siteId={content.siteId} resolvedData={content.resolvedData} />;
 *   }
 *
 *   // Render entry with custom UI
 *   return (
 *     <article>
 *       <h1>{content.entry.title}</h1>
 *       <div>{content.entry.content.body}</div>
 *     </article>
 *   );
 * }
 * ```
 *
 * @example Entry-specific rendering based on content type
 * ```tsx
 * const content = useContent({ client, siteId, path });
 *
 * if (content.loading) return <Spinner />;
 * if (content.error) return <Error error={content.error} />;
 *
 * if (content.type === 'entry') {
 *   switch (content.entry.type) {
 *     case 'blog-post':
 *       return <BlogPost entry={content.entry} theme={content.theme} />;
 *     case 'product':
 *       return <ProductPage entry={content.entry} theme={content.theme} />;
 *   }
 * }
 *
 * return <Page {...content} />;
 * ```
 */
declare function useContent(params: UseContentParams): UseContentResult;

/**
 * Create a Riverbank CMS client for fetching content
 *
 * @example
 * ```ts
 * const client = createRiverbankClient({
 *   apiKey: 'bld_live_sk_...',
 *   baseUrl: 'https://dashboard.example.com/api',
 * });
 *
 * const site = await client.getSite({ slug: 'my-site' });
 * ```
 */
declare function createRiverbankClient(config: RiverbankClientConfig): RiverbankClient;

export { type ContentEntryData, PageProps, RiverbankClient, RiverbankClientConfig, type UseContentParams, type UseContentResult, createRiverbankClient, isContentError, isContentLoading, isEntryContentResult, isPageContentResult, useContent };
