<?php
declare( strict_types=1 );

namespace FiboFilters\Filters\Types;

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

/**
 * Class CategoryHierarchical
 */
class CategoryHierarchical extends Category {
	/**
	 * This is the name of this filter type.
	 *
	 * @var string
	 */
	protected $filter_type = 'category-hierarchical';

	/**
	 * Filter values based on context
	 *
	 * @param array $values Filter values.
	 *
	 * @return array
	 */
	protected function filter_values( array $values ): array {
		// We need this to properly calculate categories counters.
		if (
			$this->context['conditions']['is_product_taxonomy'] &&
			$this->context['details']['taxonomy'] === 'product_cat'
		) {
			$this->set_prop( 'showing_sibling_categories', true );
		}

		return $values;
	}
}
