module.exports = app => {
  const tutorials = require("../controllers/tutorial.controller.js");
  const client = require("../controllers/client.controller.js");
  const user = require("../controllers/user.api.js");
  const purchase_history = require("../controllers/purchase_history.controller.js");
  const transaction_history = require("../controllers/transaction_history.controller.js");
  const payment_type = require("../controllers/payment_type.controller.js");
  const exchange = require("../controllers/exchange.controller.js");

  var router = require("express").Router();

  // Create a new Tutorial
  router.post("/tutorials/", tutorials.create);

  // Retrieve all Tutorials
  router.get("/tutorials/", tutorials.findAll);

  // Retrieve all published Tutorials
  router.get("/tutorials/published", tutorials.findAllPublished);

  // Retrieve a single Tutorial with id
  router.get("/tutorials/:id", tutorials.findOne);

  // Update a Tutorial with id
  router.put("/tutorials/:id", tutorials.update);
 
  // Delete a Tutorial with id
  router.delete("/tutorials/:id", tutorials.delete);

  // Delete all Tutorials
  router.delete("/tutorials/", tutorials.deleteAll);

 // router.use("/api/user", require("../controllers/user.api"));
 
  router.post("/user/login", user.login);

  // router.post("/client/", client.create);

  router.get("/client/", client.findAll);
  
  router.delete("/client/:id", client.delete);
  
  // Retrieve a single Tutorial with id
  router.get("/client/:id", client.findOne);

  // Update a Tutorial with id
  router.put("/client/:id", client.update);

  router.get("/purchase_history/", purchase_history.findAll);

  router.get("/payment_type/", payment_type.findAll);
  
  router.get("/exchange_history/", exchange.findAll);
 
  router.post("/transaction_history/", transaction_history.create);

  router.get("/transaction_history/", transaction_history.findAll);
  
  router.delete("/transaction_history/:id", transaction_history.delete);
  
  // Retrieve a single Tutorial with id
  router.get("/transaction_history/:id", transaction_history.findOne);

  // Update a Tutorial with id
  router.put("/transaction_history/:id", transaction_history.update);

  router.get("/last_transaction_history", transaction_history.lastOne);

  app.use('/api', router);
//  router.use("/api/user", require("../controllers/user.api"));

//  app.use('/api/tutorials', router);
};
