<?php
/**
 * Source-specific, non-destructive finding response guidance.
 *
 * @package LocalGuardScanner
 */

namespace LocalGuardScanner\Admin;

/**
 * Provides inspection, conditional correction and verification steps.
 */
final class FindingRemediationCatalog {
	/** @return array{inspection:string[],correction:string[],verification:string[]} */
	public function guide( string $kind ): array {
		$guides = array(
			'file'    => array(
				'inspection'   => array(
					__( 'Preserve a backup or forensic copy before changing the file.', 'localguard-scanner' ),
					__( 'Identify which WordPress, plugin or theme package owns the path and compare it with the same official version.', 'localguard-scanner' ),
				),
				'correction'   => array( __( 'If the difference is unauthorized, replace the affected file or complete component with a tested clean copy.', 'localguard-scanner' ) ),
				'verification' => array( __( 'Confirm the unexpected code is gone, clear relevant caches and run a new scan with complete file coverage.', 'localguard-scanner' ) ),
			),
			'plugin'  => array(
				'inspection'   => array( __( 'Confirm the installed version, activation state and the vendor advisory that applies to it.', 'localguard-scanner' ) ),
				'correction'   => array( __( 'After a tested backup, update or replace the plugin; remove it if it is inactive and no longer required.', 'localguard-scanner' ) ),
				'verification' => array( __( 'Confirm the safe version is installed and run LocalGuard again.', 'localguard-scanner' ) ),
			),
			'content' => array(
				'inspection'   => array(
					__( 'Run the read-only query in a trusted database administration session and review the same item in WordPress.', 'localguard-scanner' ),
					__( 'Export the content row and its related metadata before editing it; verify author, type, status and dates.', 'localguard-scanner' ),
				),
				'correction'   => array( __( 'If injection is confirmed, remove only the unauthorized content through WordPress or a controlled database workflow, then review other content from the same author and time period.', 'localguard-scanner' ) ),
				'verification' => array( __( 'Run the query again, clear page and object caches, and complete a new database scan.', 'localguard-scanner' ) ),
			),
			'option'  => array(
				'inspection'   => array(
					__( 'Run the read-only query in a trusted database administration session and identify the plugin or theme that owns the option.', 'localguard-scanner' ),
					__( 'Export the complete row before changing it. Do not edit part of a serialized value because its length metadata can be corrupted.', 'localguard-scanner' ),
				),
				'correction'   => array( __( 'If injection is confirmed, restore the complete value from a trusted source or use the owning component’s safe settings workflow; then update, replace or deactivate the vulnerable component after testing.', 'localguard-scanner' ) ),
				'verification' => array( __( 'Run the query again, clear page and object caches, rotate privileged credentials if executable code was injected, and complete a new scan.', 'localguard-scanner' ) ),
			),
			'user'    => array(
				'inspection'   => array(
					__( 'Confirm the account, registration date and administrator authorization with another trusted administrator.', 'localguard-scanner' ),
					__( 'Preserve an audit record and use the read-only query to review site capabilities and user level.', 'localguard-scanner' ),
				),
				'correction'   => array( __( 'If the account is unauthorized, revoke its sessions before removing privileges or deleting it through WordPress; rotate privileged and hosting credentials and review content attributed to it.', 'localguard-scanner' ) ),
				'verification' => array( __( 'Confirm the account can no longer authenticate or administer the site, then scan again for related accounts and persistence.', 'localguard-scanner' ) ),
			),
		);
		if ( isset( $guides[ $kind ] ) ) {
			return $guides[ $kind ];
		}
		return array(
			'inspection'   => array( __( 'Preserve a backup and investigate the identifier with a trusted administrator.', 'localguard-scanner' ) ),
			'correction'   => array( __( 'Make no change until the affected object and its owner have been identified.', 'localguard-scanner' ) ),
			'verification' => array( __( 'Run a new complete scan after any authorized correction.', 'localguard-scanner' ) ),
		);
	}
}
