import { RefObject } from 'react'; import { SceneBackground } from '../types/wall.mjs'; interface WallSubmitInput { name: string; email: string; message: string; photoUrl: string; } interface UseWallSubmitOptions { /** Reference to the in-memory wall token from `useWallToken`. */ tokenRef: RefObject; /** True when the URL carried a token; only then will the AI scene step run. */ aiEnabled: boolean; /** Backgrounds list — one is picked at random for each generation. */ backgrounds: SceneBackground[]; /** Defaults: '/api/wall', '/api/generate-wall-scene', '/api/wall-scenes'. */ postEndpoint?: string; generateEndpoint?: string; scenesEndpoint?: string; /** Called after a successful post (use this to refresh the post list). */ onPostCreated?: () => void; /** Called after a successful AI scene generation (use to refresh scenes). */ onSceneCreated?: () => void; } interface UseWallSubmitResult { submit: (post: WallSubmitInput) => Promise; submitting: boolean; /** True for ~3s after a successful post — useful for a transient "Posted!" badge. */ submitted: boolean; generating: boolean; generationStatus: string; creditsExhausted: boolean; } /** * Wraps the standard wall posting flow: * 1. POST /api/wall to persist the message + photo. * 2. Optionally POST /api/generate-wall-scene (only when `aiEnabled`) to * kick off the credit-metered AI scene generation, passing the in-memory * token from `useWallToken`. * 3. POST /api/wall-scenes to persist the generated scene. * * The hook handles the credits-exhausted signal (`NO_CREDITS` in the response * body), the transient submitted/generating UI flags, and the optional * onPostCreated / onSceneCreated callbacks for the consumer to refresh state. */ declare function useWallSubmit(opts: UseWallSubmitOptions): UseWallSubmitResult; export { type UseWallSubmitOptions, type UseWallSubmitResult, type WallSubmitInput, useWallSubmit };