<?php

/**
 * The public-facing functionality of the plugin.
 *
 * @since      1.0.0
 *
 * @package    Woocommerce_Product_Tabs
 */

namespace Barn2\Plugin\WC_Product_Tabs_Pro;

/**
 * The public-facing functionality of the plugin.
 */
class Tab_Post_Type {

	/**
	 * The main plugin instance.
	 *
	 * @since    1.1.0
	 * @access   private
	 * @var      string    $plugin    The main plugin instance.
	 */
	private $plugin;

	/**
	 * The ID of this plugin.
	 *
	 * @since    1.0.0
	 * @access   private
	 * @var      string    $plugin_name    The ID of this plugin.
	 */
	private $plugin_name;

	/**
	 * The version of this plugin.
	 *
	 * @since    1.0.0
	 * @access   private
	 * @var      string    $version    The current version of this plugin.
	 */
	private $version;
	private $product_tabs_list;

	/**
	 * Initialize the class and set its properties.
	 *
	 * @since    1.0.0
	 * @var      string    $plugin_name       The name of the plugin.
	 * @var      string    $version    The version of this plugin.
	 */
	public function __construct( $plugin ) {
		$this->plugin            = $plugin;
		$this->plugin_name       = $plugin->get_slug();
		$this->version           = $plugin->get_version();
		$this->load();
	}

	/**
	 * Register all of the hooks related to the public-facing functionality
	 * of the plugin.
	 *
	 * @since    1.0.0
	 * @access   private
	 */
	public function load() {
		// Public custom hooks
		add_filter( 'init', [ $this, 'custom_post_types' ] );
	}

	public function custom_post_types() {
		$labels = [
			'name'               => _x( 'Tabs', 'post type general name', 'woocommerce-product-tabs' ),
			'singular_name'      => _x( 'Tab', 'post type singular name', 'woocommerce-product-tabs' ),
			'menu_name'          => _x( 'Product Tabs', 'admin menu', 'woocommerce-product-tabs' ),
			'name_admin_bar'     => _x( 'Tab', 'add new on admin bar', 'woocommerce-product-tabs' ),
			'add_new'            => _x( 'Add New', WOOCOMMERCE_PRODUCT_TABS_POST_TYPE_TAB, 'woocommerce-product-tabs' ),
			'add_new_item'       => __( 'Add New Tab', 'woocommerce-product-tabs' ),
			'new_item'           => __( 'New Tab', 'woocommerce-product-tabs' ),
			'edit_item'          => __( 'Edit Tab', 'woocommerce-product-tabs' ),
			'view_item'          => __( 'View Tab', 'woocommerce-product-tabs' ),
			'all_items'          => __( 'Product Tabs', 'woocommerce-product-tabs' ),
			'search_items'       => __( 'Search Tabs', 'woocommerce-product-tabs' ),
			'parent_item_colon'  => __( 'Parent Tabs:', 'woocommerce-product-tabs' ),
			'not_found'          => __( 'No tabs found.', 'woocommerce-product-tabs' ),
			'not_found_in_trash' => __( 'No tabs found in Trash.', 'woocommerce-product-tabs' )
		];

		$args = [
			'labels'             => $labels,
			'public'             => false,
			'publicly_queryable' => false,
			'show_ui'            => true,
			'query_var'          => false,
			'capability_type'    => 'post',
			'has_archive'        => false,
			'hierarchical'       => false,
			'show_in_menu'       => 'wpt-options',
			'taxonomies'         => [ 'product_tag' ],
			'supports'           => [ 'title', 'editor' ],
		];

		register_post_type( WOOCOMMERCE_PRODUCT_TABS_POST_TYPE_TAB, $args );

	}

}
