/** * Base Virus Scan Provider * Abstract class providing common functionality for virus scan providers */ import type { VirusScanProvider, VirusScanResult, VirusScanProviderConfig } from '@plyaz/types/storage'; import type { createApiClient } from '@plyaz/api'; /** * Abstract base class for virus scan providers * Provides common functionality like validation, error handling, and statistics */ export declare abstract class BaseVirusScanProvider implements VirusScanProvider { abstract readonly providerName: string; protected readonly config: VirusScanProviderConfig; protected scansPerformed: number; protected threatsDetected: number; protected totalScanTime: number; protected apiClientGetter?: () => Awaited> | null; constructor(config?: VirusScanProviderConfig); /** * Set API client getter (called by plugin after provider creation) * Allows provider to access the plugin's API client */ setApiClientGetter(getter: () => Awaited> | null): void; /** * Validate provider configuration * Override in subclasses for provider-specific validation */ protected validateConfig(): void; /** * Get API client for making HTTP requests * Returns null if API client not configured or not set by plugin * Subclasses should call this to get the API client */ protected getApiClient(): Awaited> | null; /** * Scan a file for viruses/malware * Template method that handles validation and calls provider-specific scan */ scan(file: Buffer, filename: string): Promise; /** * Provider-specific scan implementation * Must be implemented by subclasses */ protected abstract scanFile(file: Buffer, filename: string): Promise; /** * Check if provider is available and healthy * Override in subclasses for provider-specific health checks */ isAvailable(): Promise; /** * Get provider statistics */ getStatistics(): Promise<{ scansPerformed: number; threatsDetected: number; averageScanTime: number; }>; /** * Reset statistics */ resetStatistics(): void; }