<?php
/**
 * Help & Documentation page
 *
 * Learn about Solomon Schema features and schema markup.
 *
 * @package BW_Schema
 * @since 3.0.0-babel
 */

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

class BW_Schema_Page_Help extends BW_Schema_Page {

	/**
	 * Initialize page properties
	 *
	 * @return void
	 */
	protected function init() {
		$this->slug   = 'bw-schema-help';
		$this->title  = __( 'Help', 'bw-schema' );
		$this->icon   = 'dashicons-editor-help';
		$this->parent_slug = 'bw-schema';
	}

	/**
	 * Render page content
	 *
	 * @return void
	 */
	protected function render() {
		echo '<p class="description">';
		echo esc_html__( 'Learn about Solomon Schema features, schema markup, and best practices.', 'bw-schema' );
		echo '</p>';

		// Getting started
		$this->render_getting_started();

		// Common tasks
		$this->render_common_tasks();

		// Schema reference
		$this->render_schema_reference();

		// Support
		$this->render_support();
	}

	/**
	 * Render getting started section
	 *
	 * @return void
	 */
	private function render_getting_started() {
		echo '<h2>' . esc_html__( 'Getting Started', 'bw-schema' ) . '</h2>';

		echo '<ol style="margin-left: 20px;">';

		echo '<li>';
		echo '<strong>' . esc_html__( 'Run the setup wizard', 'bw-schema' ) . '</strong>';
		echo '<br />';
		printf(
			/* translators: %s: link to the setup wizard */
			esc_html__( 'The %s walks you through organization, contact, people, and content in four steps.', 'bw-schema' ),
			'<a href="' . esc_url( admin_url( 'admin.php?page=bw-schema-setup' ) ) . '">' . esc_html__( 'setup wizard', 'bw-schema' ) . '</a>'
		);
		echo '</li>';

		echo '<li style="margin-top: 15px;">';
		echo '<strong>' . esc_html__( 'Set up your organization', 'bw-schema' ) . '</strong>';
		echo '<br />';
		echo esc_html__( 'Or go to the Organization page and enter your business name, contact information, and logo.', 'bw-schema' );
		echo '</li>';

		echo '<li style="margin-top: 15px;">';
		echo '<strong>' . esc_html__( 'Configure your locations', 'bw-schema' ) . '</strong>';
		echo '<br />';
		echo esc_html__( 'If you have multiple locations, add them to help search engines understand your presence.', 'bw-schema' );
		echo '</li>';

		echo '<li style="margin-top: 15px;">';
		echo '<strong>' . esc_html__( 'Set up your team', 'bw-schema' ) . '</strong>';
		echo '<br />';
		echo esc_html__( 'Create team member posts to get author schema on your blog posts.', 'bw-schema' );
		echo '</li>';

		echo '</ol>';
	}

	/**
	 * Render common tasks section
	 *
	 * @return void
	 */
	private function render_common_tasks() {
		echo '<h2>' . esc_html__( 'Common Tasks', 'bw-schema' ) . '</h2>';

		echo '<h3 style="font-size: 13px; margin-top: 15px;">' . esc_html__( 'How do I add my business logo?', 'bw-schema' ) . '</h3>';
		echo '<p>' . esc_html__( 'Go to Organization Settings and upload your logo. This will appear in search results and rich snippets.', 'bw-schema' ) . '</p>';

		echo '<h3 style="font-size: 13px; margin-top: 15px;">' . esc_html__( 'How do I check my schema markup?', 'bw-schema' ) . '</h3>';
		echo '<p>' . esc_html__( 'Use Google\'s Rich Results Test tool or Schema.org validation at ', 'bw-schema' );
		echo '<code>https://schema.org</code>';
		echo esc_html__( ' to verify your markup.', 'bw-schema' );
		echo '</p>';

		echo '<h3 style="font-size: 13px; margin-top: 15px;">' . esc_html__( 'Does Solomon Schema slow down my site?', 'bw-schema' ) . '</h3>';
		echo '<p>' . esc_html__( 'No. Solomon Schema uses JSON-LD markup which is lightweight and asynchronous. Markup is cached for better performance.', 'bw-schema' ) . '</p>';
	}

	/**
	 * Render schema reference section
	 *
	 * @return void
	 */
	private function render_schema_reference() {
		echo '<h2>' . esc_html__( 'Schema Types', 'bw-schema' ) . '</h2>';

		echo '<p>' . esc_html__( 'Solomon Schema automatically generates schema markup for:', 'bw-schema' ) . '</p>';

		$schema_types = array(
			'Organization' => __( 'Your business identity with name, logo, contact info', 'bw-schema' ),
			'LocalBusiness' => __( 'Business location with address and phone', 'bw-schema' ),
			'BreadcrumbList' => __( 'Navigation breadcrumbs for site structure', 'bw-schema' ),
			'Article' => __( 'Blog post metadata (author, publish date, image)', 'bw-schema' ),
			'Person' => __( 'Team member profiles with biography', 'bw-schema' ),
			'FAQ' => __( 'Frequently asked questions and answers', 'bw-schema' ),
		);

		echo '<ul style="list-style: none; padding: 0;">';

		foreach ( $schema_types as $type => $description ) {
			echo '<li style="padding: 10px 0; border-bottom: 1px solid #eee;">';
			echo '<strong>' . esc_html( $type ) . '</strong> — ';
			echo esc_html( $description );
			echo '</li>';
		}

		echo '</ul>';
	}

	/**
	 * Render support section
	 *
	 * @return void
	 */
	private function render_support() {
		echo '<h2>' . esc_html__( 'Support & Resources', 'bw-schema' ) . '</h2>';

		echo '<ul>';
		echo '<li><strong>' . esc_html__( 'Schema.org Documentation', 'bw-schema' ) . '</strong> — ';
		echo '<a href="https://schema.org/" target="_blank" rel="noopener noreferrer">schema.org</a>';
		echo '</li>';
		echo '<li><strong>' . esc_html__( 'Google Rich Results Test', 'bw-schema' ) . '</strong> — ';
		echo '<a href="https://search.google.com/test/rich-results" target="_blank" rel="noopener noreferrer">Google Search Console</a>';
		echo '</li>';
		echo '<li><strong>' . esc_html__( 'Solomon Schema Documentation', 'bw-schema' ) . '</strong> — ';
		echo '<a href="https://bowdenworks.com" target="_blank" rel="noopener noreferrer">Bowden Works</a>';
		echo '</li>';
		echo '</ul>';
	}
}
