import * as _tanstack_react_query from '@tanstack/react-query';
import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from './stack.BQmuNl5p.js';
import { z } from 'zod';

/**
 * Options for the usePosts hook
 */
interface UsePostsOptions {
    /** Filter posts by tag name */
    tag?: string;
    /** Filter posts by tag slug */
    tagSlug?: string;
    /** Number of posts to fetch per page (default: 10) */
    limit?: number;
    /** Whether to enable the query (default: true) */
    enabled?: boolean;
    /** Search query to filter posts by title, content, or excerpt */
    query?: string;
    /** Filter by published status */
    published?: boolean;
    /** Filter by specific post slug */
    slug?: string;
}
/**
 * Result from the usePosts hook
 */
interface UsePostsResult {
    /** Array of fetched posts */
    posts: SerializedPost[];
    /** Whether the initial load is in progress */
    isLoading: boolean;
    /** Error if the query failed */
    error: Error | null;
    /** Function to load the next page of posts */
    loadMore: () => void;
    /** Whether there are more posts to load */
    hasMore: boolean;
    /** Whether the next page is being loaded */
    isLoadingMore: boolean;
    /** Function to refetch the posts */
    refetch: () => void;
}
/**
 * Options for the usePostSearch hook
 */
interface UsePostSearchOptions {
    /** Search query string to filter posts */
    query: string;
    /** Whether to enable the search query (default: true) */
    enabled?: boolean;
    /** Debounce delay in milliseconds (default: 300) */
    debounceMs?: number;
    /** Number of results to return (default: 10) */
    limit?: number;
    /** Filter by published status (default: true) */
    published?: boolean;
}
/**
 * Result from the usePostSearch hook
 */
interface UsePostSearchResult {
    /** Array of posts matching the search query */
    posts: SerializedPost[];
    /** Alias for posts (React Query compatibility) */
    data: SerializedPost[];
    /** Whether the search is in progress */
    isLoading: boolean;
    /** Error if the search failed */
    error: Error | null;
    /** Function to refetch the search results */
    refetch: () => void;
    /** Whether a search is currently in progress (includes debounce time) */
    isSearching: boolean;
    /** The debounced search query being used */
    searchQuery: string;
}
/**
 * Result from the usePost hook
 */
interface UsePostResult {
    /** The fetched post, or null if not found */
    post: SerializedPost | null;
    /** Whether the post is being loaded */
    isLoading: boolean;
    /** Error if the query failed */
    error: Error | null;
    /** Function to refetch the post */
    refetch: () => void;
}
/** Input type for creating a new post */
type PostCreateInput = z.infer<typeof createPostSchema>;
/** Input type for updating an existing post */
type PostUpdateInput = z.infer<typeof updatePostSchema>;
/**
 * Hook for fetching paginated posts with load more functionality
 */
declare function usePosts(options?: UsePostsOptions): UsePostsResult;
/** Suspense variant of usePosts */
declare function useSuspensePosts(options?: UsePostsOptions): {
    posts: SerializedPost[];
    loadMore: () => Promise<unknown>;
    hasMore: boolean;
    isLoadingMore: boolean;
    refetch: () => Promise<unknown>;
};
/**
 * Hook for fetching a single post by slug
 */
declare function usePost(slug?: string): UsePostResult;
/** Suspense variant of usePost */
declare function useSuspensePost(slug: string): {
    post: SerializedPost | null;
    refetch: () => Promise<unknown>;
};
/**
 * Hook for fetching all unique tags across posts
 */
declare function useTags(): {
    tags: SerializedTag[];
    isLoading: boolean;
    error: Error | null;
    refetch: () => void;
};
/** Suspense variant of useTags */
declare function useSuspenseTags(): {
    tags: SerializedTag[];
    refetch: () => Promise<unknown>;
};
/** Create a new post */
declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
    tags: ({
        name: string;
    } | {
        id: string;
        name: string;
        slug: string;
    })[];
    title: string;
    content: string;
    excerpt: string;
    published: boolean;
    slug?: string | undefined;
    createdAt?: Date | undefined;
    updatedAt?: Date | undefined;
    publishedAt?: Date | undefined;
    image?: string | undefined;
}, unknown>;
/** Update an existing post by id */
declare function useUpdatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
    id: string;
    data: PostUpdateInput;
}, unknown>;
/** Delete a post by id */
declare function useDeletePost(): _tanstack_react_query.UseMutationResult<{
    success: boolean;
}, Error, {
    id: string;
}, unknown>;
/**
 * Hook for searching posts by a free-text query. Uses `usePosts` under the hood.
 * Debounces the query and preserves last successful results to avoid flicker.
 */
declare function usePostSearch({ query, enabled, debounceMs, limit, published, }: UsePostSearchOptions): UsePostSearchResult;
/**
 * Options for the useNextPreviousPosts hook
 */
interface UseNextPreviousPostsOptions {
    /** Whether to enable the query (default: true) */
    enabled?: boolean;
}
/**
 * Result from the useNextPreviousPosts hook
 */
interface UseNextPreviousPostsResult {
    /** The previous post (older), or null if none exists */
    previousPost: SerializedPost | null;
    /** The next post (newer), or null if none exists */
    nextPost: SerializedPost | null;
    /** Whether the query is loading */
    isLoading: boolean;
    /** Error if the query failed */
    error: Error | null;
    /** Function to refetch the posts */
    refetch: () => void;
}
/**
 * Hook for fetching previous and next posts relative to a given date
 * Uses useInView to only fetch when the component is in view
 */
declare function useNextPreviousPosts(createdAt: string | Date, options?: UseNextPreviousPostsOptions): UseNextPreviousPostsResult & {
    ref: (node: Element | null) => void;
    inView: boolean;
};
/**
 * Options for the useRecentPosts hook
 */
interface UseRecentPostsOptions {
    /** Maximum number of recent posts to fetch (default: 5) */
    limit?: number;
    /** Slug of a post to exclude from results */
    excludeSlug?: string;
    /** Whether to enable the query (default: true) */
    enabled?: boolean;
}
/**
 * Result from the useRecentPosts hook
 */
interface UseRecentPostsResult {
    /** Array of recent posts */
    recentPosts: SerializedPost[];
    /** Whether the query is loading */
    isLoading: boolean;
    /** Error if the query failed */
    error: Error | null;
    /** Function to refetch the posts */
    refetch: () => void;
}
/**
 * Hook for fetching recent posts
 * Uses useInView to only fetch when the component is in view
 */
declare function useRecentPosts(options?: UseRecentPostsOptions): UseRecentPostsResult & {
    ref: (node: Element | null) => void;
    inView: boolean;
};

export { useSuspensePosts as f, usePost as g, useSuspensePost as h, useTags as i, useSuspenseTags as j, useCreatePost as k, useUpdatePost as l, useDeletePost as m, usePostSearch as n, useNextPreviousPosts as q, useRecentPosts as t, usePosts as u };
export type { PostCreateInput as P, UsePostsOptions as U, UsePostsResult as a, UsePostSearchOptions as b, UsePostSearchResult as c, UsePostResult as d, PostUpdateInput as e, UseNextPreviousPostsOptions as o, UseNextPreviousPostsResult as p, UseRecentPostsOptions as r, UseRecentPostsResult as s };
