<?php
/**
 * Alert notification policy.
 *
 * @package LocalGuardScanner
 */

namespace LocalGuardScanner\Application\Notifications;

/**
 * Allows a message only for new, unnotified high-risk findings.
 */
final class NotificationPolicy {
	/**
	 * @param array<int,array<string,mixed>> $findings Candidate findings.
	 * @return bool
	 */
	public function should_send( array $findings ) {
		foreach ( $findings as $finding ) {
			if ( isset( $finding['severity'] ) && in_array( $finding['severity'], array( 'high', 'critical' ), true ) ) {
				return true;
			}
		}
		return false;
	}
}
