// Web-only storage service (localStorage, no SecureStore)

export const StorageService = {
  async setItem(key: string, value: string): Promise<boolean> {
    try {
      localStorage.setItem(key, value)
      return true
    } catch (e) {
      console.error('StorageService setItem error:', e)
      return false
    }
  },

  async getItem(key: string): Promise<string | null> {
    try {
      return localStorage.getItem(key)
    } catch (e) {
      console.error('StorageService getItem error:', e)
      return null
    }
  },

  async removeItem(key: string): Promise<boolean> {
    try {
      localStorage.removeItem(key)
      return true
    } catch (e) {
      console.error('StorageService removeItem error:', e)
      return false
    }
  },

  async clearAll(keys: string[]): Promise<boolean> {
    try {
      keys.forEach((key) => localStorage.removeItem(key))
      return true
    } catch (e) {
      console.error('StorageService clearAll error:', e)
      return false
    }
  },
}
