<?php

$regenerateSteps = require_once(__DIR__ . '/hooks/page-update--regenerate-project-steps-cache.php');

return [
  'debug'       => Dir::exists('assets/dist') ? false: true,
  'cache' => [
    'pages' => [
      'active' => true
    ],
    'api' => true
  ],
  'smartypants' => true,
  'locale'      => 'fr_FR.utf-8',
  'date'        => [
    'handler' => 'intl',
  ],
  'api' => [
    'basicAuth' => true,
    // Enable api access without SSL. To disable in production.
    'allowInsecure' => true,
  ],
  'panel' => [
    'language' => 'fr',
    'css'      => 'assets/css/panel.css',
    'favicon'  => 'favicon.svg',
    'menu'     => require(__DIR__ . '/menu.php'),
  ],
  'routes' => [
    require(__DIR__ . '/routes/logout.php'),
    require(__DIR__ . '/routes/login.php'),
    require(__DIR__ . '/routes/toggle-favorite.php'),
    require(__DIR__ . '/routes/upload-images.php'),
    require(__DIR__ . '/routes/save-page.php'),
    require(__DIR__ . '/routes/save-file.php'),
    require(__DIR__ . '/routes/remove-file.php'),
    require(__DIR__ . '/routes/update-password.php'),
    require(__DIR__ . '/routes/update-email.php'),
    require(__DIR__ . '/routes/upload-pdf.php'),
    require(__DIR__ . '/routes/validate-brief.php'),
    require(__DIR__ . '/routes/request-project-creation.php'),
    require(__DIR__ . '/routes/request-optimization-appointment.php'),
  ],
  'hooks' => [
    'page.create:after'  => require_once(__DIR__ . '/hooks/create-steps.php'),
    'page.delete:before' => require_once(__DIR__ . '/hooks/delete-steps.php'),
    'page.update:after' => $regenerateSteps,
    'page.changeStatus:after' => $regenerateSteps,
    'file.update:after' => require_once(__DIR__ . '/hooks/file-update--regenerate-project-steps-cache.php')
  ],
];
