function getToken(): string | null {
  return localStorage.getItem("token");
}

function setToken(token: string): void {
  localStorage.setItem("token", token);
}

function removeToken(): void {
  localStorage.removeItem("token");
}

function getRefreshToken(): string | null {
  return localStorage.getItem("refresh_token");
}

function setRefreshToken(token: string): void {
  localStorage.setItem("refresh_token", token);
}

function removeRefreshToken(): void {
  localStorage.removeItem("refresh_token");
}

function getTheme(): string {
  return localStorage.getItem("theme") || "tokyo-night";
}

function setTheme(theme: string): void {
  localStorage.setItem("theme", theme);
}

function getSelectedLibrary(): string | null {
  return localStorage.getItem("selectedLibrary");
}

function setSelectedLibrary(libraryId: string): void {
  localStorage.setItem("selectedLibrary", libraryId);
}

function getSelectedBook(): string | null {
  return localStorage.getItem("selectedBook");
}

function setSelectedBook(bookId: string): void {
  localStorage.setItem("selectedBook", bookId);
}

function clearAll(): void {
  localStorage.clear();
}

export {
  clearAll,
  getRefreshToken,
  getSelectedBook,
  getSelectedLibrary,
  getTheme,
  getToken,
  removeRefreshToken,
  removeToken,
  setRefreshToken,
  setSelectedBook,
  setSelectedLibrary,
  setTheme,
  setToken
};
