<?php
/**
 * Finding state transitions.
 *
 * @package LocalGuardScanner
 */

namespace LocalGuardScanner\Application\Findings;

/**
 * Resolves temporal status without deleting historical evidence.
 */
final class FindingLifecycle {
	const NEW_STATUS = 'new';
	const PERSISTENT = 'persistent';
	const RESOLVED   = 'resolved';
	const IGNORED    = 'ignored';

	/**
	 * @param string|null $previous Previous status.
	 * @param bool        $present  Whether evidence is present now.
	 * @param bool        $ignored  Whether a suppression applies.
	 * @return string
	 */
	public function next_status( $previous, $present, $ignored = false ) {
		if ( $ignored && $present ) {
			return self::IGNORED;
		}
		if ( ! $present ) {
			return self::RESOLVED;
		}
		if ( null === $previous || self::RESOLVED === $previous ) {
			return self::NEW_STATUS;
		}
		return self::PERSISTENT;
	}
}
