const express = require('express');
const router = express.Router();
const authController = require('../controllers/authController');

router.post('/google', authController.loginWithGoogle);
router.post('/google/register', authController.registerWithGoogle); // Add register route
router.post('/test-login', authController.testLogin);
router.post('/refresh', authController.refreshToken);

const verifyToken = require('../middleware/authMiddleware').verifyToken; // Correct import

router.get('/test-protected', verifyToken, (req, res) => {
  res.json({ success: true, message: 'You have a valid token', user: req.user });
});

router.get('/me', verifyToken, authController.getMe);
router.delete('/withdraw', verifyToken, authController.withdraw);

// Future place for:
// router.post('/kakao', authController.loginWithKakao);
// router.post('/naver', authController.loginWithNaver);

module.exports = router;
