import { apiGet, apiPost } from '@/lib/http'
import type { AdminNotificationConfig, AdminNotificationTestResult } from '@/types/admin'

export function fetchAdminNotificationConfig() {
  return apiGet<{
    filePath: string
    source: AdminNotificationConfig
  }>('/api/v1/admin/platform-config/notifications')
}

export function saveAdminNotificationConfig(payload: AdminNotificationConfig) {
  return apiPost<{
    filePath: string
    source: AdminNotificationConfig
  }>('/api/v1/admin/platform-config/notifications', payload)
}

export function testAdminNotification(payload: { title?: string; body?: string; url?: string }) {
  return apiPost<AdminNotificationTestResult>(
    '/api/v1/admin/platform-config/notifications/test',
    payload,
  )
}
