var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import DatabaseConfig from "../DatabaseConfig";
import { AppApiHostname } from "../EnvironmentConfig";
import BaseService from "./BaseService";
import Route from "../../Types/API/Route";
import URL from "../../Types/API/URL";
import API from "../../Utils/API";
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
export class StatusPageCertificateService extends BaseService {
    constructor() {
        super();
    }
    async add(domain) {
        const body = {
            domain: domain,
        };
        const httpProtocol = await DatabaseConfig.getHttpProtocol();
        return await API.post({
            url: new URL(httpProtocol, AppApiHostname, new Route("/api/workers/cert")),
            data: body,
        });
    }
    async remove(domain) {
        const httpProtocol = await DatabaseConfig.getHttpProtocol();
        const body = {
            domain: domain,
        };
        return await API.delete({
            url: new URL(httpProtocol, AppApiHostname, new Route("/api/workers/cert")),
            data: body,
        });
    }
    async get(domain) {
        const body = {
            domain: domain,
        };
        const httpProtocol = await DatabaseConfig.getHttpProtocol();
        return await API.get({
            url: new URL(httpProtocol, AppApiHostname, new Route("/api/workers/cert")),
            data: body,
        });
    }
}
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], StatusPageCertificateService.prototype, "add", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], StatusPageCertificateService.prototype, "remove", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], StatusPageCertificateService.prototype, "get", null);
export default new StatusPageCertificateService();
//# sourceMappingURL=StatusPageCertificateService.js.map