<?php
/**
 *  Solidshop  —  Shopping cart for Joomla!
 *  ─────────────────────────────────────────
 *
 *  @author     Solid Labs <contact@solidshop.app>
 *  @link       https://www.solidshop.app
 *  @copyright  © 2026 Solid Labs. All rights reserved.
 *  @license    GPL-3.0-or-later
 */

defined('_JEXEC') or die;

use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Solidshoppayment\PayPal\Extension\PayPal;

return new class () implements ServiceProviderInterface {
    public function register(Container $container): void
    {
        $container->set(
            PluginInterface::class,
            function (Container $container) {
                $plugin = new PayPal(
                    $container->get(DispatcherInterface::class),
                    (array) PluginHelper::getPlugin('solidshoppayment', 'paypal')
                );
                $plugin->setApplication(Factory::getApplication());

                return $plugin;
            }
        );
    }
};
