<?php

namespace Sibs\Sibs\Model;

use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Checkout\Model\Session as CheckoutSession;
use Magento\Framework\View\Asset\Repository as AssetRepository;
use Sibs\Sibs\Helper\DataHelper;
use Sibs\Sibs\Model\SibsConstants;

class SibsConfigProvider implements ConfigProviderInterface
{
    /**
     * @var \Magento\Framework\View\Asset\Repository
     */
    protected $_assetRepository;

    /**
     * @var \Sibs\Sibs\Helper\DataHelper
     */
    protected $_sibsHelper;

    /**
     * @var \Magento\Checkout\Model\Session
     */
    protected $_checkoutSession;

    public function __construct(
        AssetRepository $assetRepository,
        DataHelper $sibsHelper,
        CheckoutSession $checkoutSession
    ) {
        $this->_assetRepository = $assetRepository;
        $this->_sibsHelper      = $sibsHelper;
        $this->_checkoutSession = $checkoutSession;
    }

    public function getConfig()
    {
        return [
            'payment' => [
                'creditcard' => [
                    'code'         => SibsConstants::SIBS_PAYMENT_METHOD_CREDITCARD,
                    'title'        => __('SIBS Credit Card'),
                    'logoSrc'      => $this->_assetRepository->getUrl('Sibs_Sibs::images/i_creditcard.png'),
                    'instructions' => $this->_sibsHelper->getCCInstruction(),
                ],
                'blik' => [
                    'code'         => SibsConstants::SIBS_PAYMENT_METHOD_BLIK,
                    'title'        => __('SIBS BLIK'),
                    'logoSrc'      => $this->_assetRepository->getUrl('Sibs_Sibs::images/i_blik.png'),
                    'instructions' => $this->_sibsHelper->getBLIKInstruction(),
                ],
                'pbl' => [
                    'code'         => SibsConstants::SIBS_PAYMENT_METHOD_PAY_BY_LINK,
                    'title'        => __('SIBS Pay By Link'),
                    'logoSrc'      => $this->_assetRepository->getUrl('Sibs_Sibs::images/i_pblkv.png'),
                    'instructions' => $this->_sibsHelper->getPBLInstruction(),
                ],
                'xpay' => [
                    'code'         => SibsConstants::SIBS_PAYMENT_METHOD_XPAY,
                    'title'        => __('SIBS Xpay'),
                    'logoSrc'      => $this->_assetRepository->getUrl('Sibs_Sibs::images/i_xpay.png'),
                    'instructions' => $this->_sibsHelper->getXpayInstruction(),
                ],
            ],
        ];
    }
}
