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

const VOICE_PERSONA_STORAGE_KEY = "haixun.patrol.voice_persona_id";

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

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