<?php
declare(strict_types=1);

namespace Ekesto\CacheInvalidator\Integrations\Builders;

use Ekesto\CacheInvalidator\Integrations\Builders\Adapters\BeaverBuilder;
use Ekesto\CacheInvalidator\Integrations\Builders\Adapters\DiviBuilder;
use Ekesto\CacheInvalidator\Integrations\Builders\Adapters\ElementorBuilder;
use Ekesto\CacheInvalidator\Integrations\Builders\Adapters\GutenbergBuilder;
use Ekesto\CacheInvalidator\Integrations\Builders\Adapters\WPBakeryBuilder;

/**
 * Registry for supported builder detectors.
 */
final class BuildersRegistry
{
    /**
     * Return all builders in priority order.
     *
     * @return BuilderInterface[]
     */
    public function all(): array
    {
        return [
            new ElementorBuilder(),
            new BeaverBuilder(),
            new DiviBuilder(),
            new WPBakeryBuilder(),
            new GutenbergBuilder(),
        ];
    }

    /**
     * Return fallback builder.
     *
     * @return BuilderInterface
     */
    public function fallback(): BuilderInterface
    {
        return new GutenbergBuilder();
    }
}
