const Client = require('../Client')

/**
 * Instance class
 */
class InstanceCLI extends Client {
  instanceBasePath = () => `v1/instances/${this.instance}`

  /**
   * Upgrade iOS version on instance
   * @returns {Promise<any>}
   */
  upgrade = async (options) => {
    const { os, osbuild } = options
    return await this._fetch('POST', `${this.instanceBasePath()}/upgrade`, { os, osbuild })
  }

  /**
   * Fetch instance information
   * @returns {Promise<any>}
   */
  info = async () => {
    return await this._fetch('GET', `${this.instanceBasePath()}`, {})
  }
}

module.exports = InstanceCLI
