<?php

declare(strict_types=1);

namespace BookiFlex\Extensions\Taxation;

use BookiFlex\Core\Contract\ExtensionInterface;
use BookiFlex\Core\Contract\PluginInterface;
use BookiFlex\Extensions\Taxation\Admin\TaxationSettings;

defined( 'ABSPATH' ) || exit;

/**
 * This is sample extension for BookiFlex plugin.
 */
class Taxation implements ExtensionInterface
{
    protected PluginInterface $plugin;

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

        $plugin->getContainer()->register(new ServiceProvider());

        $plugin->addConfig([
            'settings' => [[
                'tab'     => 'taxation',
                'factory' => new TaxationSettings(),
                'name'    => __('Taxation', 'bookiflex'),
            ]],
        ]);
    }

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

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

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