import { apiClient } from './client'
import type { ConversationsResponse, ConversationDetailResponse } from '@/types/conversation'
import type { ApiResponse } from '@/types/api'

/**
 * Conversations API
 */
export const conversationsApi = {
  /**
   * Get paginated list of conversations
   */
  async getConversations(
    page = 1,
    perPage = 20,
    language?: string
  ): Promise<ConversationsResponse> {
    const params: Record<string, any> = { page, per_page: perPage }
    if (language) params.language = language
    return apiClient.get<ConversationsResponse>('conversations', params)
  },
  
  /**
   * Get single conversation with messages
   */
  async getConversation(id: string, language?: string): Promise<ConversationDetailResponse> {
    const params = language ? `?language=${language}` : ''
    return apiClient.get<ConversationDetailResponse>(`conversations/${id}${params}`)
  },
  
  /**
   * Delete conversation
   */
  async deleteConversation(id: string): Promise<ApiResponse> {
    return apiClient.delete<ApiResponse>(`conversations/${id}`)
  },
}










