<?php

/**
 * Tag Sitemap Provider
 *
 * Generates sitemaps for tags
 *
 * @package ProRank\SEO\Modules\Indexing\Sitemaps
 * @since   0.1.0
 */

declare(strict_types=1);

namespace ProRank\SEO\Modules\Indexing\Sitemaps;

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


/**
 * Tag sitemap provider class
 */


class TagSitemapProvider extends CategorySitemapProvider {
    
    /**
     * Provider slug
     *
     * @var string
     */
    protected string $slug = 'post_tag';
    
    /**
     * Provider name
     *
     * @var string
     */
    protected string $name = 'Tags';
    
    /**
     * Get term priority based on post count
     *
     * @param \WP_Term $term Term object
     * @return float
     */
    protected function get_term_priority(\WP_Term $term): float {
        // Tags typically have lower priority than categories
        if ($term->count > 50) {
            return 0.6;
        } elseif ($term->count > 20) {
            return 0.5;
        } elseif ($term->count > 5) {
            return 0.4;
        } elseif ($term->count > 0) {
            return 0.3;
        }
        
        return 0.2;
    }
}
