<?php
namespace WPLens\Schema\Generators;

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

final class SpeakableGenerator implements \WPLens\Schema\Generator {

	public function get_slug(): string  { return 'speakable'; }
	public function get_label(): string { return __( 'SpeakableSpecification (voice assistant hint)', 'lens-ai-visibility-monitor' ); }

	public function applies( ?\WP_Post $post = null ): bool {
		return $post instanceof \WP_Post && in_array( $post->post_type, array( 'post', 'page' ), true );
	}

	public function generate( ?\WP_Post $post = null ): ?array {
		// Suggest speakable hints for the title and the first paragraph.
		// CSS selector approach is the most compatible target.
		return array(
			'@type'      => 'SpeakableSpecification',
			'cssSelector'=> array( 'h1', '.entry-title', '.entry-content > p:first-of-type' ),
		);
	}
}
