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 { inject } from '@adonisjs/core';
import router from '@adonisjs/core/services/router';
import vine from '@vinejs/vine';
import { RouteName } from '../../routes.js';
import { AKVineResponse } from '../crud/vine_handler_decorators.js';
import { OpenApiDescription } from './openapi_router_macros.js';
import AKOpenApiService from './service/index.js';
let AKOpenApiController = class AKOpenApiController {
    openApiService;
    constructor(openApiService) {
        this.openApiService = openApiService;
    }
    async spec() {
        return this.openApiService.spec;
    }
    async view() {
        const scalarCustomCss = '';
        const url = router.makeUrl(RouteName.openapiSpec);
        return `
    <!doctype html>
    <html>
      <head>
        <title>API Reference</title>
        <meta charset="utf-8" />
        <meta
          name="viewport"
          content="width=device-width, initial-scale=1" />
        <style>
        ${scalarCustomCss}
        </style>
      </head>
      <body>
        <script id="api-reference" data-url="${url}"></script>
        <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
      </body>
    </html>
  `;
    }
};
__decorate([
    OpenApiDescription(`Get OpenApi schema of the current API. (json)`),
    AKVineResponse(vine.object({})),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], AKOpenApiController.prototype, "spec", null);
AKOpenApiController = __decorate([
    inject(),
    __metadata("design:paramtypes", [AKOpenApiService])
], AKOpenApiController);
export default AKOpenApiController;
//# sourceMappingURL=openapi_controller.js.map