import { apiClient } from './client'
import type { MatchDetailResponse, MatchComment, MatchCommentCreate } from '@/types/match'

export const matchesApi = {
  getMatch: async (betId: number): Promise<MatchDetailResponse> => {
    const response = await apiClient.get<MatchDetailResponse>(`/api/v1/matches/${betId}`)
    return response.data
  },

  getComments: async (betId: number): Promise<MatchComment[]> => {
    const response = await apiClient.get<MatchComment[]>(`/api/v1/matches/${betId}/comments`)
    return response.data
  },

  addComment: async (betId: number, data: MatchCommentCreate): Promise<MatchComment> => {
    const response = await apiClient.post<MatchComment>(`/api/v1/matches/${betId}/comments`, data)
    return response.data
  },
}
