import { Router } from 'express';
import { AuthController } from '../controllers/AuthController';
import { requireTraceContext } from '../../core/guards/trace-context.guard';

const router = Router();

/**
 * [CORE_AUTH_01] 多租户身份中心路由
 */

// 公开接口
router.post('/login', AuthController.login);
router.post('/refresh', AuthController.refreshToken);
router.post('/register', AuthController.register);
router.post('/oauth2/token', AuthController.oauth2Token);

// 需要认证的接口
router.get('/me', requireTraceContext, AuthController.me);
router.post('/mfa/enable', requireTraceContext, AuthController.enableMFA);
router.post('/mfa/verify', requireTraceContext, AuthController.verifyMFA);
router.get('/oauth2/authorize', requireTraceContext, AuthController.oauth2Authorize);
router.post('/oauth2/client', requireTraceContext, AuthController.createOAuth2Client);

export default router;
