'use strict';

class Service {
  constructor(data = {}) {
    this.api = data.api;
    this.org = data.org;
    this.serviceName = data.serviceName || 'demo';
  }

  async copy(data = {}) {
    const options = {
      method: 'POST',
      endpoint: `/orgs/${this.org.orgName}/services/${this.serviceName}/copy`,
      body: data,
    };

    return await this.api.request(options);
  }

  async listInstances() {
    const options = {
      method: 'GET',
      endpoint: `/orgs/${this.org.orgName}/services/${this.serviceName}/instances`,
    };

    return await this.api.request(options);
  }
}

module.exports = Service;
