<?php

namespace Signteer\ProPromo\Web\Page;

use Plainwork\Http\Request;
use Plainwork\Ui\Html;

final class PromoPage
{
    public function __invoke(Request $request)
    {
        $ret = [];
        $html = new Html();

        $ret[] = '__This feature is available in Signteer Pro.__';

        if (function_exists('\signteer_fs')) {
            $to = \signteer_fs()->get_upgrade_url();
        } else {
            $to = 'https://www.signteer.com/get/';
        }

        $orderLink = $html->link($to, [], 'Buy now');
        $orderLink->setFull($to);
        // $orderLink->withAttr('target', '_blank');
        $orderLink->withAttr('class', 'button-primary');

        $ret[] = $orderLink;

        $ret = $html->blockList($ret);

        $ret = $html->main($ret);
        $ret->title = $html->el('h1', '__Upgrade to Signteer Pro__');

        return $ret;
    }
}
