<?php

declare(strict_types=1);

/*
 * This file is part of the Ferienpass package.
 *
 * (c) Richard Henkenjohann <richard@ferienpass.online>
 *
 * For more information visit the project website <https://ferienpass.online>
 * or the documentation under <https://docs.ferienpass.online>.
 */

namespace Ferienpass\CoreBundle\Payments;

use Ferienpass\CoreBundle\Payments\Provider\PaymentProviderInterface;
use Ferienpass\CoreBundle\Settings\SystemSettingsManager;

class PaymentSystem
{
    public function __construct(
        private readonly PaymentProviderInterface $paymentProvider,
        private readonly SystemSettingsManager $systemSettingsManager,
    ) {
    }

    /**
     * Two ways in, and either is enough: the municipality says it takes
     * payments, or it has configured an online provider (which would be
     * pointless otherwise).
     */
    public function isEnabled(): bool
    {
        return $this->systemSettingsManager->isPaymentsEnabled() || $this->paymentProvider->isConfigured();
    }

    public function hasOnlineProvider(): bool
    {
        return $this->paymentProvider->isConfigured();
    }
}
