<?php

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

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\GdResult;
use Freefactu_Vendor\Endroid\QrCode\Writer\Result\GifResult;
use Freefactu_Vendor\Endroid\QrCode\Writer\Result\ResultInterface;
final class GifWriter extends AbstractGdWriter
{
    public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?LabelInterface $label = null, array $options = []): ResultInterface
    {
        /** @var GdResult $gdResult */
        $gdResult = parent::write($qrCode, $logo, $label, $options);
        return new GifResult($gdResult->getMatrix(), $gdResult->getImage());
    }
}
