import { safeGetItem, safeRemoveItem, safeSetItem } from "./safeStorage";

const VOICE_PERSONA_STORAGE_KEY = "haixun.publish.voice_persona_id";

export function readPublishVoicePersonaId(): string {
  return safeGetItem(VOICE_PERSONA_STORAGE_KEY);
}

export function persistPublishVoicePersonaId(personaId: string) {
  const trimmed = personaId.trim();
  if (!trimmed) {
    safeRemoveItem(VOICE_PERSONA_STORAGE_KEY);
    return;
  }
  safeSetItem(VOICE_PERSONA_STORAGE_KEY, trimmed);
}
