<?php

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

if ( ! class_exists( 'SBUY_Taxonomy' ) ) {
	/**
	 * Taxonomy class
	 *
	 * @since 1.0.0
	 */
	class SBUY_Taxonomy {

		/**
		 * Constructor
		 *
		 * @since 1.0.0
		 */
		public function __construct() {
			$this->taxonomy();
		}

		/**
		 * Product tag and category taxonomy
		 *
		 * @since 1.0.0
		 */
		public function taxonomy() {
			register_taxonomy( 'sbuy_product_tag', 'sbuy_product', array(
				'hierarchical' => false,
				'label'        => esc_html__( 'Tag', 'simply-buy' ),
				'rewrite'      => array(
					'slug'       => 'product_tag',
					'with_front' => false,
				),
			) );

			register_taxonomy( 'sbuy_product_category', 'sbuy_product', array(
				'hierarchical' => true,
				'label'        => esc_html__( 'Category', 'simply-buy' ),
				'rewrite'      => array(
					'slug'       => 'product_category',
					'with_front' => false,
				),
			) );
		}
	}
}
