import { Router } from 'express'

import { getAdminMessageDeliveries } from '../../services/admin/admin-message-delivery-service.js'
import { createJsonHandler } from './shared.js'
import type { AdminMessageDeliveryRouteQuery } from '../../types/admin-route-inputs.js'

const router = Router()

router.get('/message-deliveries', createJsonHandler(
  (req) => getAdminMessageDeliveries(req.query as AdminMessageDeliveryRouteQuery),
  {
    successMessage: 'ok',
    errorMessage: '读取消息发送记录失败',
    scope: '[admin/message-deliveries]',
  },
))

export default router
