<?php

namespace Sibs\Sibs\Block;

use Magento\Framework\Registry;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Sibs\Sibs\Helper\DataHelper as SibsHelper;

class Info extends Template
{
    protected $coreRegistry;

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

    public function __construct(
        Context $context,
        Registry $registry,
        SibsHelper $SibsHelper,
        array $data = []
    ) {
        $this->coreRegistry = $registry;
        $this->_helper      = $SibsHelper;
        parent::__construct($context, $data);
    }

    public function getOrder()
    {
        return $this->coreRegistry->registry('current_order');
    }

    public function getOrderAdditionalInformation()
    {
        return $this->getOrder()->getPayment()->getAdditionalInformation();
    }

    public function getInstructions()
    {
        $code = $this->getOrder()->getPayment()->getMethodInstance()->getCode();

        return $this->_helper->getInstructionByCode($code);
    }
}
