<?php
/**
 * The main class blocks settings page.
 *
 * @package Smart_Post_Show_Pro
 * @subpackage Smart_Post_Show_Pro/admin/views
 */

if ( ! defined( 'ABSPATH' ) ) {
	die;
} // Cannot access pages directly.

/**
 * Smart Post Show Pro blocks settings Page.
 */
class SPSP_Blocks {

	/**
	 * Smart Post Show Pro single instance of the class
	 *
	 * @var null The instance of the class.
	 * @since 2.0
	 *
	 * @return void
	 */
	protected static $instance = null;

	/**
	 * Main Smart_Post_Show_Pro_blocks Instance
	 *
	 * @since 2.0
	 * @static
	 *
	 * @return self help instance
	 */
	public static function instance() {
		if ( is_null( self::$instance ) ) {
			self::$instance = new self();
		}

		return self::$instance;
	}


		/**
		 * Add admin sub-menu.
		 *
		 * @return void
		 */
	public function blocks_page_menu() {
		global $submenu;

		// remove the default order.
		remove_submenu_page( 'edit.php?post_type=sp_post_carousel', 'edit.php?post_type=sp_post_carousel' );
		remove_submenu_page( 'edit.php?post_type=sp_post_carousel', 'post-new.php?post_type=sp_post_carousel' );

		// first Quick Start.
		add_submenu_page(
			'edit.php?post_type=sp_post_carousel',
			__( 'Smart Post Dashboard', 'smart-post-show-pro' ),
			__( 'Quick Start', 'smart-post-show-pro' ),
			apply_filters( 'pcp_user_role_permission', 'manage_options' ),
			'pcp_blocks',
			// 'edit.php?post_type=sp_post_carousel&page=pcp_blocks#',
			array( $this, 'blocks_page_callback' )
		);

		// second Blocks.
		add_submenu_page(
			'edit.php?post_type=sp_post_carousel',
			__( 'Smart Post Dashboard', 'smart-post-show-pro' ),
			__( 'Blocks', 'smart-post-show-pro' ),
			apply_filters( 'pcp_user_role_permission', 'manage_options' ),
			'edit.php?post_type=sp_post_carousel&page=pcp_blocks#blocks'
		);

		add_submenu_page(
			'edit.php?post_type=sp_post_carousel',
			__( 'Smart Post Dashboard', 'smart-post-show-pro' ),
			__( 'Saved Templates', 'smart-post-show-pro' ),
			apply_filters( 'pcp_user_role_permission', 'manage_options' ),
			'edit.php?post_type=sp_post_carousel&page=pcp_blocks#savedTemplate'
		);

		// third Website Builder.
		// add_submenu_page(
		// 'edit.php?post_type=sp_post_carousel',
		// __( 'Smart Post Dashboard', 'smart-post-show-pro' ),
		// __( 'Website Builder', 'smart-post-show-pro' ),
		// apply_filters( 'pcp_user_role_permission', 'manage_options' ),
		// 'edit.php?post_type=sp_post_carousel&page=pcp_blocks#webBuilder'
		// );

		// Settings Sub-menu.
		add_submenu_page(
			'edit.php?post_type=sp_post_carousel',
			__( 'Post Carousel Settings', 'smart-post-show-pro' ),
			__( 'Settings', 'smart-post-show-pro' ),
			apply_filters( 'pcp_user_role_permission', 'manage_options' ),
			'edit.php?post_type=sp_post_carousel&page=pcp_blocks#settings'
		);

		// Finally default manus.
		add_submenu_page(
			'edit.php?post_type=sp_post_carousel',
			__( 'All Shows', 'smart-post-show-pro' ),
			__( 'Manage Shows', 'smart-post-show-pro' ),
			'edit_posts',
			'edit.php?post_type=sp_post_carousel'
		);

		add_submenu_page(
			'edit.php?post_type=sp_post_carousel',
			__( 'Add Show', 'smart-post-show-pro' ),
			__( 'Add New Show', 'smart-post-show-pro' ),
			'edit_posts',
			'post-new.php?post_type=sp_post_carousel'
		);
	}




	/**
	 * The Post Carousel Help Callback.
	 *
	 * @return void
	 */
	public function blocks_page_callback() {
		echo '<div id="sp-smart-post-blocks-settings-page" class="sp-smart-post-blocks-settings-page"></div>';
	}
}
