import { apiClient } from './client'

export interface SupportingDataItem {
  id: string
  session_id: string
  label: string
  data_type: 'text_snippet' | 'screenshot'
  content: string
  content_type: string | null
  sort_order: number
  created_at: string
  updated_at: string
}

export async function getSupportingData(sessionId: string): Promise<SupportingDataItem[]> {
  const response = await apiClient.get(`/sessions/${sessionId}/supporting-data`)
  return response.data
}

export async function createSupportingData(
  sessionId: string,
  data: { label: string; data_type: string; content: string; content_type?: string }
): Promise<SupportingDataItem> {
  const response = await apiClient.post(`/sessions/${sessionId}/supporting-data`, data)
  return response.data
}

export async function updateSupportingData(
  sessionId: string,
  itemId: string,
  data: { label?: string; content?: string }
): Promise<SupportingDataItem> {
  const response = await apiClient.patch(`/sessions/${sessionId}/supporting-data/${itemId}`, data)
  return response.data
}

export async function deleteSupportingData(sessionId: string, itemId: string): Promise<void> {
  await apiClient.delete(`/sessions/${sessionId}/supporting-data/${itemId}`)
}
