'use strict';

class Org {
  constructor(data = {}) {
    this.cloud = data.cloud;
    this.user = data.user;
    this.accessKey = process.env.SERVERLESS_ACCESS_KEY;
    this.orgName = data.orgName;
  }

  async getOrgName() {
    this.orgName = this.orgName || (await this.user.getOrgName());
    return this.orgName;
  }

  async getAccessKey() {
    this.accessKey = this.accessKey || (await this.user.getToken());
    return this.accessKey;
  }

  async authorize() {
    await this.getOrgName();
    await this.getAccessKey();
  }

  async listServices() {
    // todo when we need it
  }
}

module.exports = Org;
