import { Client, Collection, Server } from '.';
import serverSetup from '../api';

export default class ServerManagement {
  public client: Client;

  public servers: Collection<Server>;

  constructor(client: Client) {
    this.client = client;
    this.servers = new Collection<Server>();
    this.loadServers();
  }

  public async loadServers() {
    const apiRoot = Object.entries<(management: ServerManagement) => Server>(serverSetup);
    for (const [api, server] of apiRoot) {
      this.servers.add(api, server(this));
      this.client.util.signale.success(`Successfully loaded server '${api}'.`);
    }
  }
}
