// 导出所有多租户信用额度路由
import { OpenAPIHono } from '@hono/zod-openapi';
import { AuthContext } from '@d8d/shared-types';

import getBalanceRoutes from './get-balance.mt';
import setLimitRoutes from './set-limit.mt';
import adjustLimitRoutes from './adjust-limit.mt';
import getBalanceLogsRoutes from './get-balance-logs.mt';
import paymentRoutes from './payment.mt';
import checkoutRoutes from './checkout.mt';
import meRoutes from './me.mt';

// 聚合所有信用额度路由
// 注意：meRoutes必须在getBalanceRoutes之前，否则/me会被/:userId匹配
const creditBalanceRoutes = new OpenAPIHono<AuthContext>()
  .route('/', meRoutes)
  .route('/', getBalanceRoutes)
  .route('/', setLimitRoutes)
  .route('/', adjustLimitRoutes)
  .route('/', getBalanceLogsRoutes)
  .route('/', paymentRoutes)
  .route('/', checkoutRoutes);

export default creditBalanceRoutes;
export { creditBalanceRoutes };