// retoor <retoor@molodetz.nl>

import { ApiTester } from "./ApiTester.js";
import { CodeCopy } from "./CodeCopy.js";
import { DevRantTester } from "./DevRantTester.js";
import { DevRantLogin } from "./DevRantLogin.js";

export class ApiDocs {
    constructor() {
        this.copy = new CodeCopy();
        const ctx = window.DEVPLACE_DOCS || { loggedIn: false, username: "", apiKey: "", isAdmin: false };
        ctx.base = location.origin;
        const mounts = document.querySelectorAll("[data-api-tester]");
        this.testers = [...mounts].map((mount) => new ApiTester(mount, ctx));
        this.devrantLogins = [...document.querySelectorAll("[data-devrant-login]")].map(
            (mount) => new DevRantLogin(mount),
        );
        this.devrantTesters = [...document.querySelectorAll("[data-devrant-tester]")].map(
            (mount) => new DevRantTester(mount),
        );
    }
}

new ApiDocs();
window.ApiDocs = ApiDocs;
