<?php
declare(strict_types=1);

namespace Ekesto\CacheInvalidator;

use Ekesto\CacheInvalidator\Core\WooCommerce\WooCommerceIntegrationRegistry;

/**
 * Provides optional archive-resolution defaults.
 */
final class ArchiveDefaultsProvider
{
    /**
     * Return allowed taxonomy slugs for archive resolution by post type.
     *
     * Returning null keeps default behavior (no taxonomy restriction).
     *
     * @param string $postType Post type slug.
     * @return string[]|null
     */
    public static function getAllowedTaxonomiesForPostType(string $postType): ?array
    {
        $postType = sanitize_key($postType);
        if ($postType === '') {
            return null;
        }

        return WooCommerceIntegrationRegistry::current()->getAllowedTaxonomiesForPostType($postType);
    }
}
