"use client";

import {
  NavigationStorage,
  type PendingChatUnlock,
  type PendingChatUnlockKind,
  type PendingChatUnlockStage,
} from "@/data/storage/navigation";

export type {
  PendingChatUnlock,
  PendingChatUnlockKind,
  PendingChatUnlockStage,
};

export async function savePendingChatUnlock(input: {
  messageId: string;
  kind: PendingChatUnlockKind;
  returnUrl: string;
  stage: PendingChatUnlockStage;
}): Promise<void> {
  await NavigationStorage.savePendingChatUnlock(input);
}

export async function consumePendingChatUnlock(): Promise<PendingChatUnlock | null> {
  return NavigationStorage.consumePendingChatUnlock();
}

export async function peekPendingChatUnlock(): Promise<PendingChatUnlock | null> {
  return NavigationStorage.peekPendingChatUnlock();
}

export async function hasPendingChatUnlock(): Promise<boolean> {
  return NavigationStorage.hasPendingChatUnlock();
}

export async function clearPendingChatUnlock(): Promise<void> {
  await NavigationStorage.clearPendingChatUnlock();
}
