/**
 * @module CircuitBreaker
 */
import { type Redis, type Result } from "ioredis";
import { type BackoffSettingsEnum } from "../../../../backoff-policies/_module.js";
import { type CircuitBreakerStateTransition, type ICircuitBreakerAdapter, type CircuitBreakerState } from "../../../../circuit-breaker/contracts/_module.js";
import { type CircuitBreakerPolicySettingsEnum } from "../../../../circuit-breaker/implementations/policies/_module.js";
/**
 * IMPORT_PATH: `"@daiso-tech/core/circuit-breaker/redis-circuit-breaker-adapter"`
 * @group Adapters
 */
export type RedisCircuitBreakerAdapterSettings = {
    database: Redis;
    /**
     * You can choose between different types of predefined backoff policies.
     * @default
     * ```ts
     * { type: BACKOFFS.EXPONENTIAL }
     * ```
     */
    backoff?: BackoffSettingsEnum;
    /**
     * You can choose between different types of predefined circuit breaker policies.
     * @default
     * ```ts
     * { type: POLICIES.CONSECUTIVE }
     * ```
     */
    policy?: CircuitBreakerPolicySettingsEnum;
};
declare module "ioredis" {
    interface RedisCommander<Context> {
        daiso_circuit_breaker_update_state(key: string, backoffSettings: string, policySettings: string, currentDate: number): Result<string, Context>;
        daiso_circuit_breaker_track_failure(key: string, backoffSettings: string, policySettings: string, currentDate: number): Result<void, Context>;
        daiso_circuit_breaker_track_success(key: string, backoffSettings: string, policySettings: string, currentDate: number): Result<void, Context>;
    }
}
/**
 * IMPORT_PATH: `"@daiso-tech/core/circuit-breaker/redis-circuit-breaker-adapter"`
 * @group Adapters
 */
export declare class RedisCircuitBreakerAdapter implements ICircuitBreakerAdapter {
    private readonly backoff;
    private readonly policy;
    private readonly database;
    /**
     * @example
     * ```ts
     * import { RedisCircuitBreakerAdapter } from "@daiso-tech/core/circuit-breaker/redis-circuit-breaker-adapter";
     * import Redis from "ioredis";
     *
     * const database = new Redis("YOUR_REDIS_CONNECTION_STRING");
     * const circuitBreakerAdapter = new RedisCircuitBreakerAdapter({
     *   database
     * });
     * ```
     */
    constructor(settings: RedisCircuitBreakerAdapterSettings);
    private initUpdateStateCommmand;
    private initTrackFailureCommmand;
    private initTrackSuccessCommmand;
    getState(key: string): Promise<CircuitBreakerState>;
    updateState(key: string): Promise<CircuitBreakerStateTransition>;
    isolate(key: string): Promise<void>;
    trackFailure(key: string): Promise<void>;
    trackSuccess(key: string): Promise<void>;
    reset(key: string): Promise<void>;
}
