<?php

declare(strict_types=1);

namespace App\Framework\Waf\MachineLearning;

use App\Framework\Waf\MachineLearning\ValueObjects\AnomalyDetection;
use App\Framework\Waf\MachineLearning\ValueObjects\BehaviorBaseline;
use App\Framework\Waf\MachineLearning\ValueObjects\BehaviorFeature;

/**
 * Interface for anomaly detection algorithms
 */
interface AnomalyDetectorInterface
{
    /**
     * Get detector name
     */
    public function getName(): string;

    /**
     * Get supported behavior types
     */
    public function getSupportedBehaviorTypes(): array;

    /**
     * Check if detector can analyze the given features
     */
    public function canAnalyze(array $features): bool;

    /**
     * Detect anomalies in behavioral features
     *
     * @param BehaviorFeature[] $features
     * @return AnomalyDetection[]
     */
    public function detectAnomalies(array $features, ?BehaviorBaseline $baseline = null): array;

    /**
     * Update detector model with new data
     *
     * @param BehaviorFeature[] $features
     */
    public function updateModel(array $features): void;

    /**
     * Get detector configuration
     */
    public function getConfiguration(): array;

    /**
     * Check if detector is enabled
     */
    public function isEnabled(): bool;

    /**
     * Get detector confidence threshold
     */
    public function getConfidenceThreshold(): float;

    /**
     * Set detector confidence threshold
     */
    public function setConfidenceThreshold(float $threshold): void;

    /**
     * Get expected processing time in milliseconds
     */
    public function getExpectedProcessingTime(): int;

    /**
     * Check if detector supports real-time analysis
     */
    public function supportsRealTime(): bool;
}
