<?php
/**
 * BookiFlex Payment Extension
 *
 * @package    BookiFlex
 * @subpackage Payment
 * @author     BookiFlex
 * @copyright  Copyright (c) 2025 BookiFlex
 * @license    GPL-2.0-or-later
 *
 * @link       https://bookiflex.com
 */

declare(strict_types=1);

 namespace BookiFlex\Extensions\Payment;

use BookiFlex\Core\Contract\ExtensionInterface;
use BookiFlex\Core\Contract\PluginInterface;
use BookiFlex\Extensions\Payment\Api\Controller\PaymentCallbackController;
use BookiFlex\Extensions\Payment\Api\Controller\PaymentController;
use BookiFlex\Extensions\Payment\ORM\Schema;


defined( 'ABSPATH' ) || exit;

/**
 * Support payment functionality.
 */
class Payment implements ExtensionInterface
{
    protected PluginInterface $plugin;

    public function init(PluginInterface $plugin): void
    {
        $this->plugin = $plugin;
        $plugin->getContainer()->register(new ServiceProvider());

        $plugin->addConfig([
            'controllers' => [
                PaymentController::class,
                PaymentCallbackController::class,
            ],
            'menus' => [
                Admin\Menu\PaymentMenu::class
            ],
            'schemas' => [
                Schema::class
            ],
        ]);
    }

    public function getName(): string
    {
        return 'Payment';
    }

    public function getVersion(): string
    {
        return '1.0.0';
    }

    public function isCompatible(string $pluginVersion): bool
    {
        return version_compare($pluginVersion, '1.0.0', '>=');
    }
}
