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

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

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

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