<?php
/**
 * Settings page markup — tab dispatcher for the Ppok AI Toolkit hub.
 *
 * Loaded by Admin::render_settings_page(). $this resolves to the Admin
 * instance, which supplies the tab roster and URL helpers.
 *
 * @package Ppok\AIToolkit
 * @license GPL-2.0-or-later
 */

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

/** @var \Ppok\AIToolkit\Admin\Admin $this */
$tabs    = $this->tabs();
$current = $this->current_tab();
?>
<div class="wrap ppok-ai-toolkit">
	<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>

	<nav class="nav-tab-wrapper" aria-label="<?php esc_attr_e( 'Ppok AI Toolkit sections', 'ppok-ai-toolkit' ); ?>">
		<?php foreach ( $tabs as $slug => $label ) : ?>
			<a
				href="<?php echo esc_url( $this->tab_url( $slug ) ); ?>"
				class="nav-tab <?php echo $current === $slug ? 'nav-tab-active' : ''; ?>"
			>
				<?php echo esc_html( $label ); ?>
			</a>
		<?php endforeach; ?>
	</nav>

	<?php if ( 'activity' === $current ) : ?>
		<?php ( new \Ppok\AIToolkit\Admin\Activity_Page() )->render( $this->tab_url( 'activity' ) ); ?>
	<?php else : ?>
		<form action="options.php" method="post">
			<?php
			settings_fields( \Ppok\AIToolkit\Admin\Admin::OPTION_GROUP );
			do_settings_sections( \Ppok\AIToolkit\Admin\Admin::PAGE_SLUG );
			submit_button();
			?>
		</form>
	<?php endif; ?>
</div>
