import { request } from "./client";
import type { Message } from "../types/message";

export interface MessagesResponse {
  messages: Message[];
  total: number;
}

export const messageApi = {
  fetchMessages(traceId: string, goalId: string) {
    const query = new URLSearchParams({ goal_id: goalId });
    return request<MessagesResponse>(`/api/traces/${traceId}/messages?${query.toString()}`);
  },
};
