<?php

declare(strict_types=1);

namespace BookiFlex\Extensions\Taxation;

use BookiFlex\Core\Contract\Taxation\TaxCalculatorInterface;
use BookiFlex\Core\Contract\Taxation\TaxRuleProviderInterface;
use BookiFlex\Extensions\Taxation\Provider\TaxRuleProvider;
use BookiFlex\Extensions\Taxation\Service\TaxCalculator;
use Pimple\Container;
use Pimple\ServiceProviderInterface;

defined( 'ABSPATH' ) || exit;

class ServiceProvider implements ServiceProviderInterface
{
    public function register(Container $pimple): void
    {
        $pimple[TaxRuleProviderInterface::class] = function () {
            return new TaxRuleProvider();
        };

        $pimple[TaxCalculatorInterface::class] = function ($c) {
            return new TaxCalculator(
                $c->get(TaxRuleProviderInterface::class)
            );
        };
    }
}
