<?php
namespace Modules\Systeme;

use Skeleton\Router;
use Skeleton\Module;
use Skeleton\Renderer\RendererInterface;
use Psr\Container\ContainerInterface;
use Helpers\Parametres\Parametres;
use Modules\Systeme\Controller\IntegrityCheckVerifyController;
use Modules\Systeme\Controller\LogSystemeController;
use Modules\Systeme\Controller\TraductionSystemeController;

class SystemeModule extends Module
{

    const DEFINITIONS = __DIR__ . '/config.php';

    public function __construct(ContainerInterface $container)
    {
        $container->get(RendererInterface::class)->addPath('Systeme', __DIR__ . '/views');
        

        $parametres = new Parametres();
        $global     = $parametres->expression_global;
        $gloabl_slash = $parametres->expression_point_tiret_underscore;

        $router = $container->get(Router::class);
        $base_url = $container->get('baseUrl') . $container->get('Systeme.prefix');
        

        /**
         * LOG
         */
        $router->get($base_url. '/errorLog', LogSystemeController::class, 'Systeme.GestionSysteme.index');
        $router->get($base_url. '/activeTracingRequete', LogSystemeController::class, 'Systeme.GestionSysteme.activeTracingRequete');
        
        $router->get($base_url. '/errorLog/download/{name:'.$global.'+}', LogSystemeController::class, 'Systeme.GestionSystem.downloadLog');
        $router->get($base_url. '/errorLog/downloadGeneralOxaProc/{name:'.$global.'+}', LogSystemeController::class, 'Systeme.GestionSystem.downloadGeneralOxaproc');
        $router->get($base_url. '/errorLog/downloadGeneralOxabatch/{name:'.$global.'+}', LogSystemeController::class, 'Systeme.GestionSystem.downloadGeneralOxabatch');
        $router->get($base_url. '/errorLog/downloadGeneralOxasas/{name:'.$global.'+}', LogSystemeController::class, 'Systeme.GestionSystem.downloadGeneralOxasas');
        $router->get($base_url. '/errorLog/downloadLogFile', LogSystemeController::class, 'Systeme.GestionSystem.downloadLogFile');
        $router->get($base_url. '/errorLog/downloadLogSaml/{name:'.$global.'+}', LogSystemeController::class, 'Systeme.GestionSystem.downloadSamlLog');
        $router->get($base_url. '/errorLog/visualiser/{name:'.$gloabl_slash.'+}', LogSystemeController::class, 'Systeme.GestionSystem.visualiserErrorLog');

        /**
         * TRAD
         */
        $router->get($base_url. '/trad/{name:'.$global.'+}', TraductionSystemeController::class, 'Systeme.GestionSystem.trad');
        $router->get($base_url. '/extractionTraduction', TraductionSystemeController::class, 'Systeme.GestionSystem.extractionTraduction');
        $router->get($base_url. '/extractionTraduction/ajax', TraductionSystemeController::class, 'Systeme.GestionSystem.ajaxExtractionTraduction');


        /**
         * Controle d'integrité
         */
        $router->public($base_url. '/integrity-check-verify', IntegrityCheckVerifyController::class, 'Systeme.IntegrityCheckVerify.verify');
    }
}
