// Copyright 2023 @soul-wallet/extension-base // SPDX-License-Identifier: Apache-2.0 // 'init' | 'started' | 'starting' | 'stopped' | 'stopping' import { PromiseHandler } from '@soul-wallet/extension-base/utils/promise'; export enum ServiceStatus { NOT_INITIALIZED = 'not_initialized', INITIALIZING = 'initializing', INITIALIZED = 'initialized', STARTED = 'started', STARTING = 'starting', STOPPED = 'stopped', STOPPING = 'stopping', } export interface CoreServiceInterface { status: ServiceStatus; init: () => Promise; startPromiseHandler: PromiseHandler; start: () => Promise; waitForStarted: () => Promise; } export interface StoppableServiceInterface extends CoreServiceInterface { stopPromiseHandler: PromiseHandler; stop: () => Promise; waitForStopped: () => Promise; } export interface PersistDataServiceInterface { loadData: () => Promise; persistData: () => Promise; } export interface SubscribeServiceInterface { subscribe: () => Promise; unsubscribe: () => Promise; } export interface CronServiceInterface { startCron: () => Promise; stopCron: () => Promise; }