"use client";

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

export type {
  PendingChatUnlock,
  PendingChatUnlockKind,
  PendingChatPromotion,
  PendingChatPromotionType,
  PendingChatUnlockStage,
};

export async function savePendingChatUnlock(input: {
  displayMessageId?: string;
  messageId?: string;
  kind: PendingChatUnlockKind;
  lockType?: PendingChatUnlock["lockType"];
  clientLockId?: string;
  promotion?: PendingChatPromotion;
  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();
}

export async function savePendingChatPromotion(
  promotionType: PendingChatPromotionType,
): Promise<PendingChatPromotion> {
  return NavigationStorage.savePendingChatPromotion(promotionType);
}

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

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