import type { KbxOperationRun, KbxRuntimeNotice, KbxUserNotification } from '@kbx/contracts'
import { kbxApi } from '../http/generated/kbxApiClient'

export const runtimeApi = {
  getNotice() {
    return kbxApi.request<KbxRuntimeNotice | null>('common.runtime.notice')
  },
  getOperations() {
    return kbxApi.request<KbxOperationRun[]>('common.runtime.operations', { query: { limit: 20 } })
  },
  getNotifications() {
    return kbxApi.request<KbxUserNotification[]>('common.runtime.notifications', { query: { limit: 30 } })
  },
  markNotificationRead(id: string) {
    return kbxApi.request<void>('common.runtime.notificationRead', { path: { Id: id } })
  },
}
