/**
 * Copyright 2024 Phenix Real Time Solutions, Inc. Confidential and Proprietary. All Rights Reserved.
 */

import IUserDataStore from './IUserDataStore';

export default class ObjectStoreUserStore implements IUserDataStore {
  private store: Record<string, string> = {};

  constructor() {
    this.store = {};

    this.get = this.get.bind(this);
    this.set = this.set.bind(this);
  }

  public async get(key: string, defaultValue: string): Promise<string> {
    return Promise.resolve(this.store[key] || defaultValue);
  }

  public async set(key: string, value: string): Promise<void> {
    this.store[key] = value;
    return Promise.resolve();
  }
}
