<?php
/**
 * File Path: includes/admin/tabs/class-mbs-tab-shortcodes.php
 *
 * Add to Pages Tab
 *
 * Interactive reference tab with live shortcode builders.
 * No Settings API fields — listed in AJAX_ONLY_TABS, no form wrapper.
 *
 * Shortcode builders (live preview, Copy button):
 *   [mbs_books]            — layout, columns, per_page, author, series, genre, tag, orderby, order
 *   [mbs_book]             — id
 *   [mbs_author_directory] — columns, orderby, order, show_count
 *
 * @package MyBookShowroom
 * @since   1.0.0
 */

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

class MBS_Tab_Shortcodes {

	/**
	 * Enqueue tab assets when this tab is active.
	 *
	 * @param string $current_tab Active tab slug.
	 */
	public function enqueue( string $current_tab ): void {
		if ( 'shortcodes' !== $current_tab ) {
			return;
		}

		wp_enqueue_style(
			'mbs-admin-settings-shortcodes',
			plugins_url( 'assets/css/mbs-admin-settings-shortcodes.css', MBS_DIR . 'bookshowroom.php' ),
			array( 'mbs-admin-settings' ),
			MBS_VERSION
		);

		wp_enqueue_script(
			'mbs-admin-shortcodes',
			plugins_url( 'assets/js/adminjs/mbs-admin-shortcodes.js', MBS_DIR . 'bookshowroom.php' ),
			array( 'jquery' , 'wp-i18n' ),
			MBS_VERSION,
			true
		);
		wp_set_script_translations( 'mbs-admin-shortcodes', 'my-book-showroom', MBS_DIR . 'languages' );
	}

	/**
	 * Render the Blocks & Shortcodes tab.
	 *
	 * Delegates to MBS_Tab_Shortcodes_Render::render().
	 *
	 * @return void
	 */
	public function render(): void {
		MBS_Tab_Shortcodes_Render::render();
	}
}
