import type { Provider, CreateProviderInput, UpdateProviderInput } from '@/types'
import { request } from './client'

export async function listProviders(): Promise<Provider[]> {
  return request<Provider[]>('GET', '/api/providers')
}

export async function createProvider(input: CreateProviderInput): Promise<Provider> {
  return request<Provider>('POST', '/api/providers', input)
}

export async function updateProvider(id: string, input: UpdateProviderInput): Promise<Provider> {
  return request<Provider>('PUT', `/api/providers/${id}`, input)
}

export async function deleteProvider(id: string): Promise<void> {
  return request<void>('DELETE', `/api/providers/${id}`)
}
