import { apiClient } from './client'
import type { TargetList, TargetListCreate } from '@/types'

export const targetListsApi = {
  list: (): Promise<TargetList[]> =>
    apiClient.get('/target-lists/').then(r => r.data),

  get: (id: string): Promise<TargetList> =>
    apiClient.get(`/target-lists/${id}`).then(r => r.data),

  create: (data: TargetListCreate): Promise<TargetList> =>
    apiClient.post('/target-lists/', data).then(r => r.data),

  update: (id: string, data: Partial<TargetListCreate>): Promise<TargetList> =>
    apiClient.put(`/target-lists/${id}`, data).then(r => r.data),

  delete: (id: string): Promise<void> =>
    apiClient.delete(`/target-lists/${id}`).then(() => undefined),
}
