import authProvider from "./auth";
import providers from "./providers";

type StargateOptions = {
  apiKey?: string;
  providers: Array<keyof typeof providers>;
};

class Stargate {
  apiKey?: string;
  providers: Array<keyof typeof providers>;

  constructor(options: StargateOptions) {
    this.apiKey = options.apiKey;
    this.providers = options.providers;
  }

  get tools() {
    return authProvider.install().concat(
      this.providers
        .map((provider) => {
          return providers[provider].install();
        })
        .flat(),
    );
  }
}

export default Stargate;
