text: const express = require('express');
  const { celebrate, Segments, Joi } = require('celebrate')
  
  const OngController = require('./controllers/OngController')
  const IncidentController = require('./controllers/IncidentController')
  const ProfileController = require('./controllers/ProfileController')
  const SessionController = require('./controllers/SessionController')
  
  const routes = express.Router();
  
  /*  
  *   TIPOS DE PARÂMETROS:
   * Query Params: Parâmetros nomeados enviados na rota após "?". (Ex.: .get('/users?name=Pedro'))
   * ... Ex.: .get('/users?page=12&name=Pedro') ...
   * 
   * Route Params: Parâmetros utilizados para identificar recursos após ":" (Ex.: .get(/users:id))
  */
  
  routes.post('/sessions', SessionController.create)
  
  routes.get('/ongs', OngController.index)
  routes.post('/ongs',  celebrate({
      [Segments.BODY]: Joi.object().keys({
          name: Joi.string().required(),
          email: Joi.string().required().email(),
          whatsapp: Joi.string().required().length(10),
          city: Joi.string().required(),
          uf: Joi.string().required().length(2)
      })
  }), OngController.create);
  
  routes.get('/profile', celebrate({
      [Segments.HEADERS]: Joi.object({
          authorization: Joi.string().required()
      }).unknown()
  }), ProfileController.index)
  
  routes.post('/incidents', celebrate({
      [Segments.BODY]: Joi.object().keys({
          title: Joi.string().required(),
          description: Joi.string().required(),
          value: Joi.number().required().min(0)
      })
  }), IncidentController.create)
  
  routes.get('/incidents', celebrate({
      [Segments.QUERY]: Joi.object().keys({
          page: Joi.number()
      })
  }), IncidentController.index)
  
  routes.delete('/incidents/:id', celebrate({
          [Segments.PARAMS]: Joi.object().keys({
              id: Joi.number().required(),
          })
  }), IncidentController.delete)
  
  module.exports = routes;
  