const express = require('express');
const route = express.Router();

const authorize = require('../app/service/authorize');
const authentication = require('../app/middleware/authMiddleware.js');

// ---------------------------------------------------
// ---------------------MATCH CONTROLLER---------------------
const MatchController = require('../app/controllers/Match.Controller.js');
const matchValidator = require('../app/validator/matchValidator.js');
route.post(`/add`, authentication, authorize("admin","gamer"), matchValidator.add, matchValidator.error, MatchController.add);
route.get(`/index`, authentication, authorize("admin","gamer"), MatchController.index);
route.get(`/closed-data`, authentication, authorize("admin","gamer"), MatchController.closeddata);
route.patch(`/live/:id`, authentication, authorize("admin","gamer"), MatchController.live);
route.patch(`/closed/:id`, authentication, authorize("admin","gamer"), MatchController.closed);
route.patch(`/score/:id`, authentication, authorize("admin","gamer"), MatchController.score);
route.patch(`/show/:id`, authentication, authorize("admin","gamer"), MatchController.show);
route.patch(`/lock/:id`, authentication, authorize("admin","gamer"), MatchController.lock);
route.get(`/find/:id`, authentication, authorize("admin","gamer"), MatchController.find);

// quarion
route.post(`/quartion/add/:id`, authentication, authorize("admin","gamer"), MatchController.quartionAdd);
route.get(`/quartion/:id`, authentication, authorize("admin","gamer"), MatchController.quartions);
route.patch(`/runretover/:id`, authentication, authorize("admin","gamer"), MatchController.runretover);
route.delete(`/quartion/delete/:id`, authentication, authorize("admin","gamer"), MatchController.quartiondelete);
route.patch(`/quartion/lock/:id`, authentication, authorize("admin","gamer"), MatchController.quartionlock);
route.patch(`/quartion/hide/:id`, authentication, authorize("admin","gamer"), MatchController.quartionhide);
route.put(`/quartion/update/:id`, authentication, authorize("admin","gamer"), MatchController.quartionupdate);
// answare
route.post(`/ans/add/:id`, authentication, authorize("admin","gamer"), MatchController.ansAdd);
route.patch(`/ans/lock-hide/:id/:name`, authentication, authorize("admin","gamer"), MatchController.anslockhide);
route.put(`/ans/update/:id`, authentication, authorize("admin","gamer"), MatchController.ansUpdate);
route.delete(`/ans/delete/:id`, authentication, authorize("admin","gamer"), MatchController.ansdelete);



// ----------------------------------------------------
module.exports = route;