"use client"

import {
  getMessagesAction,
  recallMessageAction,
  toggleMessageStarAction,
} from "../actions"
import type { MessageListService } from "./message-list-service"

/**
 * P1-8: 消息列表默认服务实现。
 *
 * 绑定现有 Server Actions，作为 MessageListServiceProvider 的默认注入值。
 * 测试时可替换为 mock 实现以隔离组件测试。
 */
export const defaultMessageListService: MessageListService = {
  async search(params) {
    return getMessagesAction(params)
  },

  async toggleStar(messageId) {
    return toggleMessageStarAction(messageId)
  },

  async recall(messageId) {
    return recallMessageAction(messageId)
  },
}
