<?php

namespace Config;

// Create a new instance of our RouteCollection class.
$routes = Services::routes();

/*
 * --------------------------------------------------------------------
 * Router Setup
 * --------------------------------------------------------------------
 */
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
// The Auto Routing (Legacy) is very dangerous. It is easy to create vulnerable apps
// where controller filters or CSRF protection are bypassed.
// If you don't want to define all routes, please use the Auto Routing (Improved).
// Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.
// $routes->setAutoRoute(false);

/*
 * --------------------------------------------------------------------
 * Route Definitions
 * --------------------------------------------------------------------
 */

// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->get('/', 'Home::index');
$routes->get('cookie/accept', 'Cookie::accept', ['as' => 'cookie-accept']);
$routes->get('cookie/close', 'Cookie::close', ['as' => 'cookie-close']);

$routes->get('sobre', 'Home::sobre');
$routes->get('preco', 'Home::preco');
$routes->get('funcionabilidades', 'Home::funcionabilidades');
$routes->get('cadastro', 'Home::cadastro');
$routes->get('pagina', 'Home::pagina');

$routes->get('cliente', 'Cliente::index');

/// ROTAS DE LOGIN
$routes->get('dash', 'Cliente::dashboard');
$routes->get('servicos', 'Cliente::servicos');
$routes->get('textos', 'Cliente::textos');


$routes->post('logando', 'Login::loginProcess');

/// ROTAS DE SAIDA
$routes->get('logout',              'Login::logout');


/// CALENDARIO
$routes->get('agenda', 'Calendario::index');
$routes->get('busca_eventos', 'Calendario::buscarEventos');
$routes->post('criarEvento', 'Calendario::criarEvento');
$routes->post('atualizar_evento', 'Calendario::atualizarEvento');
$routes->post('deleta_evento', 'Calendario::excluirEvento');







/*
 * --------------------------------------------------------------------
 * Additional Routing
 * --------------------------------------------------------------------
 *
 * There will often be times that you need additional routing and you
 * need it to be able to override any defaults in this file. Environment
 * based routes is one such time. require() additional route files here
 * to make that happen.
 *
 * You will have access to the $routes object within that file without
 * needing to reload it.
 */
if (is_file(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
    require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
}
