<?php
/**
 * BookiFlex Quota Manager Extension
 *
 * @package    BookiFlex
 * @subpackage QuotaManager
 * @author     BookiFlex
 * @copyright  Copyright (c) 2025 BookiFlex
 * @license    Proprietary
 *
 * @link       https://bookiflex.com
 */

declare(strict_types=1);

namespace BookiFlex\Extensions\StripePayment;

use BookiFlex\Extensions\StripePayment\Action\ConvertPaymentAction;
use BookiFlex\Core\Repository\AccommodationTypeRepository;
use BookiFlex\Extensions\StripePayment\Service\StripeLineItemBuilder;
use Pimple\Container;
use Pimple\ServiceProviderInterface;

defined( 'ABSPATH' ) || exit;

class ServiceProvider implements ServiceProviderInterface
{
    public function register(Container $pimple): void {
	    // Repositories
	    $pimple[ConvertPaymentAction::class ] = function ($c) {
		    $convertAction = new ConvertPaymentAction();

		    // Create and inject StripeLineItemBuilder service
		    $lineItemBuilder = new StripeLineItemBuilder(
			    $c->get(AccommodationTypeRepository::class)
		    );
		    $convertAction->setLineItemBuilder($lineItemBuilder);

			return $convertAction;
	    };
    }
}
