import { api } from './client'

export function fetchAlerts(encounterId, status) {
  const params = new URLSearchParams()
  if (status) params.set('status', status)
  return api.get(`/api/v1/encounters/${encounterId}/alerts?${params}`)
}

export function fetchAllAlerts(status) {
  const params = new URLSearchParams()
  if (status) params.set('status', status)
  return api.get(`/api/v1/alerts?${params}`)
}

export function acknowledgeAlert(alertId, note) {
  return api.post(`/api/v1/alerts/${alertId}/acknowledge`, { note })
}

export function resolveAlert(alertId) {
  return api.post(`/api/v1/alerts/${alertId}/resolve`)
}