import type { Got } from 'got'
import type { Hub } from '../types/device/Hub.ts'

export default (got: Got) => {
  return {
    async status() {
      return await got.get(`hub/status`).json<Hub>()
    },

    async checkFirmwareUpdate() {
      await got.put(`hub/ota/check`).json()
    },

    async installFirmwareUpdate() {
      await got.put(`hub/ota/update`).json()
    },
  }
}
