<?php

declare(strict_types=1);

namespace prj\{{.Root}}\controllers\{{.Subfolder}};

class {{.File}}_ctrl {
  public $page_output;

  public function __construct() {
    \tts\main\registry::set('db', \tts\main\registry::get('di')->get_service('db_mocker') );
  }

  public function {{.Method}}() {
    $input = \prj\{{.Root}}\inputs\{{.Subfolder}}\{{.File}}_in::{{.Method}}();

    \prj\{{.Root}}\logic\{{.Subfolder}}\{{.File}}_logic::{{.Method}}($input);

    $output = \prj\{{.Root}}\outputs\{{.Subfolder}}\{{.File}}_out::{{.Method}}($input);
    
    $html = new \tts\html_document();
    $view = new \tts\view();
    $view->set('html', $html);
    $view->set('output', $output);
    $view->set_template('main');
    $view->include("{{.Subfolder}}/{{.File}}_{{.Method}}_view");
    $view->render($this);
  }
}