// src/controllers/api.ts
// Copyright (C) 2026 Robert Colbert <rob.colbert@openplatform.us>
// All Rights Reserved

import env from "../config/env.js";
import path from "node:path";

import { DtpController } from "../lib/controller.js";

export class ApiController extends DtpController {
  get name(): string {
    return "ApiController";
  }
  get slug(): string {
    return "api";
  }
  get route(): string {
    return "/api";
  }

  constructor() {
    super();
  }

  async start(): Promise<void> {
    const envDir = env.NODE_ENV === "production" ? "dist" : "src";
    await this.loadChild(
      path.join(env.installDir, envDir, "controllers", "api", "v1.js")
    );
  }
}

export default ApiController;
