<?php
use Psr\Container\ContainerInterface;

return [
    Incoviba\Common\Alias\View::class => function(ContainerInterface $container) {
        $folders = $container->get('folders');
        $global_variables = [
            'urls' => $container->get('urls'),
            'money_url' => '',
            'login' => $container->get(Incoviba\Service\Login::class),
            'format' => $container->get(Incoviba\Service\Format::class),
            'API_KEY' => $container->get('API_KEY'),
            'UF' => $container->get(Incoviba\Service\UF::class),
            'USD' => $container->get(Incoviba\Service\USD::class),
            'IPC' => $container->get(Incoviba\Service\IPC::class),
            'hoy' => new DateTimeImmutable()
        ];
        if ($global_variables['login']->isIn()) {
            $global_variables['user'] = $global_variables['login']->getUser();
        }
        return new Incoviba\Common\Alias\View(
            $folders->get('templates'),
            $folders->get('cache'),
            null,
            $global_variables
        );
    }
];
