'use strict';

class Instance {
  constructor(data = {}) {
    this.fs = data.fs;
    this.api = data.api;
    this.org = data.org;
    this.service = data.service;
    this.instanceName = data.instanceName || 'demo';
    this.url = data.url; // will be set later by the Code class
  }

  async delete() {
    const options = {
      method: 'DELETE',
      endpoint: `/orgs/${this.org.orgName}/services/${this.service.serviceName}/instances/${this.instanceName}`,
    };
    const res = await this.api.request(options);
    return res;
  }
}

module.exports = Instance;
