<?php

namespace WPDesk\FakturyKSEF\Services;

use chillerlan\QRCode\Common\Version;
use chillerlan\QRCode\QRCode;
use chillerlan\QRCode\QROptions;
use chillerlan\QRCode\Common\EccLevel;

class QRCodeService {

	private QROptions $options;

	public function __construct() {
		$this->options = new QROptions(
			[
				'version'     => Version::AUTO,
				'outputType'  => 'png',
				'eccLevel'    => EccLevel::L,
				'scale'       => 5,
				'imageBase64' => true,
			]
		);
	}

	public function generate( string $data ): string {
		return ( new QRCode( $this->options ) )->render( $data );
	}
}
