import type { ItemEntity } from "@pie-players/pie-players-shared";
export type LoadItemOptions = {
    organizationId?: string | null;
};
export type LoadItem = (itemVId: string, opts?: LoadItemOptions) => Promise<ItemEntity>;
export declare class ItemLoadError extends Error {
    readonly code: "ITEM_NOT_FOUND" | "NO_ITEM_BANK_OR_FETCH_CONFIG" | "FETCH_NOT_AVAILABLE" | "FETCH_FAILED";
    constructor(code: ItemLoadError["code"], message: string);
}
export type CreateLoadItemOptions = {
    /**
     * Optional in-memory item bank. Keys are itemVId.
     * This enables a no-backend default for demos/tests.
     */
    itemBank?: Record<string, ItemEntity>;
    /**
     * Optional base URL for an item API. If set, `createLoadItem` will fetch when
     * an item is not present in `itemBank`.
     *
     * Example: `https://host.example.com`
     */
    fetchBaseUrl?: string;
    /**
     * Optional endpoint builder.
     * Defaults to `/api/item/:itemVId` (and appends `?organizationId=...` if provided).
     */
    itemEndpoint?: string | ((itemVId: string, opts?: LoadItemOptions) => string);
    /**
     * Custom fetch implementation (useful for tests or hosts).
     * Defaults to `globalThis.fetch`.
     */
    fetchImpl?: typeof fetch;
};
export declare function createFetchItemLoader(opts: {
    baseUrl: string;
    itemEndpoint?: CreateLoadItemOptions["itemEndpoint"];
    fetchImpl?: typeof fetch;
}): LoadItem;
/**
 * Client-resolvable default loader:
 * - resolve from `itemBank` first (no backend required)
 * - optionally fallback to fetch (encouraged backend hook)
 */
export declare function createLoadItem(opts: CreateLoadItemOptions): LoadItem;
