// @controllers/auth/all.js
const authController = require('../controllers/auth/authControllers');
const express = require('express');
const ar = express.Router();

ar.get('/', (req, res)=>{
    res.status(200).json({ message: 'This is the auth endpoint!' });
})

//POST
crouter.POST(ar, '/create', authController.create)
crouter.POST(ar, '/login', authController.login)

//GET
crouter.GET(ar, '/delete', authController.delete)
crouter.GET(ar, '/get', authController.get)
crouter.GET(ar, '/logout', authController.logout)
crouter.GET(ar, '/search', authController.search)
crouter.GET(ar, '/roles', authController.roles)
crouter.GET(ar, '/pending', authController.pendings)

//PATCH
crouter.PATCH(ar, '/update', authController.update)
crouter.PATCH(ar, '/update/clsch', authController.clsChange)
crouter.PATCH(ar, '/approve', authController.approve)

// /auth/update/infoch(name, pw change)
// /auth/update/clsch
// /auth/update/posch
// /auth/update/approve

//#region 나머지 경로에 대한 error 페이지
ar.use('/', (req, res) => {
    res.status(404).json({ 
        error: 'Not Found', 
        message: 'The requested route does not exist' 
    });
});
//#endregion

//ar.route('/...').get().post().delete() 등 이어서 사용할 수 있음

module.exports = { ar };