<?php
/**
 * Internal Link Suggester Module.
 *
 * In-editor internal link suggestions. While writing, surfaces existing posts
 * you could link to, drawn from a content engine that ignores images, headings,
 * and existing links so every suggestion is real, linkable body text. Reads
 * Yoast / Rank Math focus keywords when present to sharpen matches.
 *
 * Components:
 *   - SuggestionEngine  : matches target titles / n-grams / keywords vs content.
 *   - SuggesterMetaBox  : editor panel + AJAX + insert/copy actions.
 *   - SuggesterSettings : configuration page (count, post types, rules).
 *
 * @package Platform\Helm\Modules\Link_Suggester
 */

declare( strict_types = 1 );

namespace Platform\Helm\Modules\Link_Suggester;

use Platform\Helm\Contracts\ModuleInterface;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

final class LinkSuggesterModule implements ModuleInterface {

	private SuggesterSettings $settings;
	private SuggesterMetaBox $meta_box;
	private GutenbergPanel $gutenberg;
	private BulkSuggestPage $bulk;

	public function __construct() {
		$this->settings  = new SuggesterSettings();
		$this->meta_box  = new SuggesterMetaBox();
		$this->gutenberg = new GutenbergPanel();
		$this->bulk      = new BulkSuggestPage();
	}

	public function id(): string {
		return 'link_suggester';
	}

	public function name(): string {
		return __( 'Internal Link Suggester', 'platform-helm' );
	}

	public function description(): string {
		return __( 'In-editor internal link suggestions. As you write, suggests existing posts to link to — ignoring images, headings, and existing links so every suggestion is real body text. Configure under Helm → Link Suggestions.', 'platform-helm' );
	}

	public function default_enabled(): bool {
		return true;
	}

	public function boot(): void {
		$this->settings->register_hooks();
		$this->meta_box->register_hooks();
		$this->gutenberg->register_hooks();
		$this->bulk->register_hooks();
	}
}
