import type { FlagConfig, FlagState, FlagTransition, FeatureFlag } from './types.js';
/** Subscriber callback type for flag state changes */
export type FlagSubscriber = (flagId: string, state: FlagState, previous: FlagState) => void;
/**
 * Manages the runtime state of all registered feature flags.
 *
 */
declare class FeatureFlagManagerImpl {
    /** Current state for each registered flag */
    private readonly _states;
    /** Kill reasons stored separately to survive a disable() then re-kill cycle */
    private readonly _killReasons;
    /** In-process ordered audit log of all state transitions */
    private readonly _transitions;
    /** Active subscriber callbacks */
    private readonly _subscribers;
    constructor();
    /**
     * Returns `true` only if the flag is in the `'enabled'` state.
     * A killed flag always returns `false`.
     *
     * @param flagId - The flag's kebab-case identifier.
     */
    isEnabled(flagId: string): boolean;
    /**
     * Returns `true` if the flag has been emergency-killed.
     *
     * @param flagId - The flag's kebab-case identifier.
     */
    isKilled(flagId: string): boolean;
    /**
     * Returns the current `FlagState` for the given flag.
     * Throws if the flag id is not registered.
     *
     * @param flagId - The flag's kebab-case identifier.
     */
    getState(flagId: string): FlagState;
    /**
     * Returns a new snapshot Map of all flags with their current state.
     * Changes to the returned map do not affect the manager's internal state.
     */
    getAll(): Map<string, {
        flag: FeatureFlag;
        state: FlagState;
    }>;
    /**
     * Returns the ordered audit log of all flag state transitions recorded
     * in this process lifetime.
     */
    getTransitions(): readonly FlagTransition[];
    /**
     * Enables a flag.
     *
     * Throws if:
     *   - The flag id is not registered.
     *   - The flag is currently `'killed'` (must call `disable()` first to un-kill).
     *   - The flag is not `runtimeToggleable` and the process has already started.
     *
     * @param flagId - The flag's kebab-case identifier.
     */
    enable(flagId: string): void;
    /**
     * Disables a flag (or un-kills it, resetting to `'disabled'`).
     *
     * This is the only way to move a flag out of the `'killed'` state.
     *
     * Throws if the flag is not `runtimeToggleable` and is not currently killed
     * (un-killing a killed flag is always permitted regardless of toggleability).
     *
     * @param flagId - The flag's kebab-case identifier.
     */
    disable(flagId: string): void;
    /**
     * Emergency-kills a flag with a mandatory reason.
     *
     * A killed flag:
     *   - Returns `false` from `isEnabled()`.
     *   - Cannot be re-enabled until `disable()` is called first.
     *   - Records the kill reason in the audit log and the `_killReasons` map.
     *
     * Calling `kill()` on an already-killed flag updates the reason and
     * records a new transition (idempotent on state, not on reason).
     *
     * **Note:** `kill()` intentionally bypasses `runtimeToggleable` — it is an
     * emergency override and must never be blocked by flag configuration.
     *
     * @param flagId - The flag's kebab-case identifier.
     * @param reason - Human-readable explanation of why the flag was killed.
     */
    kill(flagId: string, reason: string): void;
    /**
     * Applies flag state overrides from the user config layer.
     *
     * - Unknown flag ids are rejected so stale configs cannot hide misspelled gates.
     * - Skips non-toggleable flags if the current state is already non-default
     *   (allows startup-only flags to be seeded via config without error).
     * - A config-level `'killed'` state is applied without a reason string;
     *   use `kill()` directly for operator-initiated kills with reasons.
     *
     * @param config - Parsed flag config block from the user config file.
     */
    loadFromConfig(config: FlagConfig): void;
    /**
     * Subscribes to flag state changes.
     *
     * The callback fires synchronously when a flag transitions state.
     * Callbacks must not throw — errors are caught and logged to stderr.
     *
     * @param callback - Called with `(flagId, newState, previousState)`.
     * @returns An unsubscribe function; call it to remove the subscription.
     */
    subscribe(callback: FlagSubscriber): () => void;
    /**
     * Validates that a flag exists and returns its declaration.
     * Throws a clear error if the id is unknown.
     */
    private _requireFlag;
    /**
     * Records a state transition, updates `_states`, writes the audit log entry,
     * and notifies all subscribers.
     */
    private _transition;
}
/**
 * Construct a fresh feature-flag manager.
 *
 * Keeping this factory in the same module as the class avoids test-runner
 * namespace quirks around cross-module construction while preserving the same
 * runtime behavior.
 */
export { FeatureFlagManagerImpl as FeatureFlagManager };
export declare function createFeatureFlagManager(): FeatureFlagManagerImpl;
//# sourceMappingURL=manager.d.ts.map