import type { AuditorService, AuditorServiceCreateEventOptions, AuditorServiceEvent, AuditorServiceEventSeverityLevel, AuthService, HttpAuthService, PluginMetadataService } from '@backstage/backend-plugin-api';
import type { JsonObject } from '@backstage/types';
import type { Request } from 'express';
/** @public */
export type AuditorEventActorDetails = {
    actorId?: string;
    ip?: string;
    hostname?: string;
    userAgent?: string;
};
/** @public */
export type AuditorEventRequest = {
    url: string;
    method: string;
};
/** @public */
export type AuditorEventStatus = {
    status: 'initiated';
} | {
    status: 'succeeded';
} | {
    status: 'failed';
    error: string;
};
/**
 * Options for creating an auditor event.
 *
 * @public
 */
export type AuditorEventOptions<TMeta extends JsonObject> = {
    /**
     * Use kebab-case to name audit events (e.g., "user-login", "file-download").
     *
     * The `pluginId` already provides plugin/module context, so avoid redundant prefixes in the `eventId`.
     */
    eventId: string;
    severityLevel?: AuditorServiceEventSeverityLevel;
    /** (Optional) The associated HTTP request, if applicable. */
    request?: Request<any, any, any, any, any>;
    /** (Optional) Additional metadata relevant to the event, structured as a JSON object. */
    meta?: TMeta;
} & AuditorEventStatus;
/**
 * Common fields of an audit event.
 *
 * @public
 */
export type AuditorEvent = {
    plugin: string;
    eventId: string;
    severityLevel: AuditorServiceEventSeverityLevel;
    actor: AuditorEventActorDetails;
    meta?: JsonObject;
    request?: AuditorEventRequest;
} & AuditorEventStatus;
/**
 * Logging function used by the auditor.
 * @public
 */
export type AuditorLogFunction = (event: AuditorEvent) => void | Promise<void>;
/**
 * A {@link @backstage/backend-plugin-api#AuditorService} implementation that logs events using a provided callback.
 *
 * @public
 *
 * @example
 * ```ts
 * export const auditorServiceFactory = createServiceFactory({
 *   service: coreServices.auditor,
 *   deps: {
 *     logger: coreServices.logger,
 *     auth: coreServices.auth,
 *     httpAuth: coreServices.httpAuth,
 *     plugin: coreServices.pluginMetadata,
 *   },
 *   factory({ logger, plugin, auth, httpAuth }) {
 *     const auditLogger = logger.child({ isAuditEvent: true });
 *     return DefaultAuditorService.create(
 *       event => auditLogger.info(`${event.plugin}.${event.eventId}`, event),
 *       { plugin, auth, httpAuth },
 *     );
 *   },
 * });
 * ```
 */
export declare class DefaultAuditorService implements AuditorService {
    private readonly logFn;
    private readonly auth;
    private readonly httpAuth;
    private readonly plugin;
    private constructor();
    /**
     * Creates a {@link DefaultAuditorService} instance.
     */
    static create(logFn: AuditorLogFunction, deps: {
        auth: AuthService;
        httpAuth: HttpAuthService;
        plugin: PluginMetadataService;
    }): DefaultAuditorService;
    private log;
    createEvent(options: AuditorServiceCreateEventOptions): Promise<AuditorServiceEvent>;
    private getActorId;
}
