<?php

namespace App\Service;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class Render extends AbstractController
{
    private $auth;

    public function __construct(Auth $auth)
    {
        $this->auth = $auth;
    }

    public function page($options, $title, $template)
    {
        $loggedIn = false;
        $role     = 0;
        $handle   = "Random Person";
        $result   = $this->auth->status();
        if ($result["status"]) {
            $loggedIn = $result["status"];
            $handle   = $result["handle"];
            $role     = $result["role"];
        }
        return $this->render($template, [
            "title"    => $title,
            "loggedIn" => $loggedIn,
            "handle"   => $handle,
            "role"     => $role,
            "options"  => $options,
        ]);
    }
}
