<?php

declare (strict_types=1);
namespace Freefactu_Vendor\Endroid\QrCode\Writer;

use Freefactu_Vendor\Endroid\QrCode\Bacon\MatrixFactory;
use Freefactu_Vendor\Endroid\QrCode\Label\LabelInterface;
use Freefactu_Vendor\Endroid\QrCode\Logo\LogoInterface;
use Freefactu_Vendor\Endroid\QrCode\QrCodeInterface;
use Freefactu_Vendor\Endroid\QrCode\Writer\Result\ConsoleResult;
use Freefactu_Vendor\Endroid\QrCode\Writer\Result\ResultInterface;
final class ConsoleWriter implements WriterInterface
{
    public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?LabelInterface $label = null, $options = []): ResultInterface
    {
        $matrixFactory = new MatrixFactory();
        $matrix = $matrixFactory->create($qrCode);
        return new ConsoleResult($matrix, $qrCode->getForegroundColor(), $qrCode->getBackgroundColor());
    }
}
