import { Query } from '@datorama/akita';
import * as O from 'fp-ts/Option';
import sessionStore from './session.store';
export class AppConfigurationQuery extends Query {
  constructor(store) {
    super(store);
    this.store = store;
    this.appConfiguration$ = this.select((state) => state.appConfiguration);
  }
  get configuration() {
    const configuration = this.getValue().appConfiguration;
    if (O.isNone(configuration)) {
      throw Error('App configuration is not yet loaded');
    }
    return configuration.value;
  }
}
export default new AppConfigurationQuery(sessionStore);
