/**
 * Copyright 2024-2025 Optimizely
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { LoggerFacade, LogLevel } from './logging/logger';
import { ResolvablePromise } from "./utils/promise/resolvablePromise";
import { Platform } from './platform_support';
export declare const SERVICE_FAILED_TO_START = "%s failed to start, reason: %s";
export declare const SERVICE_STOPPED_BEFORE_RUNNING = "%s stopped before running";
/**
 * The service interface represents an object with an operational state,
 * with methods to start and stop. The design of this interface in modelled
 * after Guava Service interface (https://github.com/google/guava/wiki/ServiceExplained).
 */
export declare enum ServiceState {
    New = 0,
    Starting = 1,
    Running = 2,
    Stopping = 3,
    Terminated = 4,
    Failed = 5
}
export type StartupLog = {
    level: LogLevel;
    message: string;
    params: any[];
};
export interface Service {
    getState(): ServiceState;
    start(): void;
    onRunning(): Promise<void>;
    stop(): void;
    onTerminated(): Promise<void>;
    makeDisposable(): void;
}
export declare abstract class BaseService implements Service {
    protected state: ServiceState;
    protected startPromise: ResolvablePromise<void>;
    protected stopPromise: ResolvablePromise<void>;
    protected logger?: LoggerFacade;
    protected startupLogs: StartupLog[];
    protected disposable: boolean;
    constructor(startupLogs?: StartupLog[]);
    makeDisposable(): void;
    setLogger(logger: LoggerFacade): void;
    protected printStartupLogs(): void;
    onRunning(): Promise<void>;
    onTerminated(): Promise<void>;
    getState(): ServiceState;
    isStarting(): boolean;
    isRunning(): boolean;
    isNew(): boolean;
    isDone(): boolean;
    start(): void;
    abstract stop(): void;
}
export declare const __platforms: Platform[];
