import { Service } from '../core/Service.js'
import { WebConfigurationBindings } from '../bindings/web/WebConfigurationBindings.js'

export default class ConfigurationService extends Service {
  static override key = 'api-service/config'
  config!: WebConfigurationBindings

  override async onCreate(): Promise<void> {
    this.config = new WebConfigurationBindings()
    return Promise.resolve()
  }

  override async onStart(): Promise<void> {
    await this.config.initialize()
  }

  get local(): WebConfigurationBindings['local'] {
    return this.config.local
  }

  get session(): WebConfigurationBindings['session'] {
    return this.config.session
  }

  get telemetry(): WebConfigurationBindings['telemetry'] {
    return this.config.telemetry
  }
}
