"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HotAgentAPI = void 0;
const HotAPI_1 = require("./HotAPI");
const HotAgentRoute_1 = require("./HotAgentRoute");
/**
 * The App's API and routes.
 */
class HotAgentAPI extends HotAPI_1.HotAPI {
    constructor(baseUrl, connection = null, db = null) {
        super(baseUrl, connection, db);
        this.key = "";
        this.secret = "";
        this.commands = {};
        this.userAuth = (req) => __awaiter(this, void 0, void 0, function* () {
            const apiKey = req.jsonObj["key"];
            const apiSecret = req.jsonObj["secret"];
            if ((apiKey !== this.key) && (apiSecret !== this.secret))
                throw new Error("Incorrect API key or secret!");
            return (true);
        });
        this.addRoute(new HotAgentRoute_1.HotAgentRoute(this));
    }
}
exports.HotAgentAPI = HotAgentAPI;
//# sourceMappingURL=HotAgentAPI.js.map