import { request } from './request' export type AlertInfo = { id: number name: string condition: string contactPointId: number customMessage: string triggerInterval: number lastStatus: string lastStatusAt: string } export const getAlerts = () => request('/api/alerts') export const createAlert = (data: Omit) => request('/api/alerts', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ data }), }) export const updateAlert = ({ id, ...body }: AlertInfo) => request(`/api/alerts/${id}`, { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body), }) export const deleteAlert = (id: number) => request(`/api/alerts/${id}`, { method: 'DELETE' }, 'void')