<?php
namespace Modules\Additional\Specifique\Client56;

use Skeleton\Router;
use Skeleton\Module;
use Psr\Container\ContainerInterface;
use Helpers\Parametres\Parametres;
use Skeleton\Renderer\RendererInterface;
use Modules\Additional\Specifique\Client56\Modules\Facture\Controller\AjaxFactureController;
use Modules\Additional\Specifique\Client56\Modules\Facture\Controller\IndexController;
use Modules\Additional\Specifique\Client56\Modules\Facture\Controller\FactureController;

class Specifique56Module extends Module
{

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



    // private $router, $container
    public function __construct(ContainerInterface $container)
    {
        $parametres     = new Parametres();
        $numFact        = $parametres->id_facture;
        $decimal        = $parametres->expression_decimal;
        $alpha          = $parametres->expression_alpha;
       
        $router = $container->get(Router::class);
        $container->get(RendererInterface::class)->addPath('Specifique56', __DIR__);
        $container->get(RendererInterface::class)->addPath('Specifique56Facture', __DIR__.'/Modules/Facture/view');
        
        $base_url = $container->get('baseUrl') . $container->get('Specifique56.prefix');


        // Controller Ajax Facture
        $router->get($base_url . '/ajax-facture/changeCdc', AjaxFactureController::class, 'Specifique56.ajax.changeCdc');

        
        /** ****************** **/
        /** Menu intermediaire **/
        /** ****************** **/
        $router->get($base_url. '/menuIntermediaire/factureSpecifique/{numFact:'.$numFact.'+}', IndexController::class, 'Specifique56.Index.menuIntermediaireFactureSpecifique');


        // Controller Facture
        $router->get($base_url . '/donnees-comptables/{numFact:'.$numFact.'+}', FactureController::class, 'Specifique56.Facture.donneesComptables');
        $router->get($base_url . '/DonneesComptables/detail-ligne/{numFact:'.$numFact.'+}/{ligne:'.$decimal.'+}', FactureController::class, 'Specifique56.Facture.ligneDetailDonneesComptables');
        $router->get($base_url. '/DonneesComptables/validation', FactureController::class, 'Specifique56.Facture.validationDonneesComptables');
        $router->get($base_url . '/EnvoiFacture/{numFact:'.$numFact.'+}/{typeEnvoi:'.$alpha.'+}', FactureController::class, 'Specifique56.Facture.envoiFacture');
        $router->get($base_url . '/DemandeCommandeRegul/{numFact:'.$numFact.'+}', FactureController::class, 'Specifique56.Facture.demandeCommandeRegul');
        $router->get($base_url . '/DemandeCommandeRegul/{numFact:'.$numFact.'+}/validationDemandeCommandeRegul', FactureController::class, 'Specifique56.Facture.validationDemandeCommandeRegul');
    }
}
