<?php
/**
 * Product condition markup
 * @var int $post_id
 * @var string $class
 * @var string $type
 * @var bool $isShopOrTaxonomy
 */

use HulkPlugins\Woo\ProductConditionManager\Services\FrontendService;

defined( 'ABSPATH' ) || exit;

$frontendService = FrontendService::getInstance();

// Label
$productConditionLabel = $frontendService->getProductConditionLabel( $post_id, $isShopOrTaxonomy );

// Condition
$productCondition = $frontendService->getProductCondition( $post_id );

if ( empty( $productCondition['condition'] ) ) {
	return;
}
?>

<div class="<?php echo $type === 'block' ? 'has-text-align-center' : ''; ?> hulk_woo_pcm_wrapper <?php echo esc_attr( $class ); ?>">
	<span class="hulk_woo_pcm_title"><?php echo esc_html( $productConditionLabel ); ?></span>
	<span class="hulk_woo_pcm_value"><?php echo esc_html( $productCondition['condition'] ); ?></span>
</div>
