/**
 * Copyright 2024 Phenix Real Time Solutions, Inc. Confidential and Proprietary. All Rights Reserved.
 */
import IndexedDb from 'services/user-store/indexed-db';
import LocalStorage from 'services/user-store/local-storage';
import ObjectStore from 'services/user-store/object-store';
import IUserDataStore from 'services/user-store/IUserDataStore';

class UserStoreService {
  private static _instance: IUserDataStore;

  public static getInstance(): IUserDataStore {
    return this._instance;
  }

  static {
    if (IndexedDb.browserSupported()) {
      this._instance = new IndexedDb();
    } else if (LocalStorage.browserSupported()) {
      this._instance = new LocalStorage();
    } else {
      this._instance = new ObjectStore();
    }
  }
}

export default UserStoreService.getInstance();
