// src/controllers/api/v1.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 ApiControllerV1 extends DtpController {
  get name(): string {
    return "ApiControllerV1";
  }
  get slug(): string {
    return "v1";
  }
  get route(): string {
    return "/v1";
  }

  constructor() {
    super();
  }

  async start(): Promise<void> {
    let basePath;
    if (env.NODE_ENV === "production") {
      basePath = path.join(env.installDir, "dist", "controllers", "api", "v1");
    } else {
      basePath = path.join(env.installDir, "src", "controllers", "api", "v1");
    }
    await this.loadChild(path.join(basePath, "auth.js"));
    await this.loadChild(path.join(basePath, "chat-session.js"));
    await this.loadChild(path.join(basePath, "contact.js"));
    await this.loadChild(path.join(basePath, "drone.js"));
    await this.loadChild(path.join(basePath, "project.js"));
    await this.loadChild(path.join(basePath, "provider.js"));
    await this.loadChild(path.join(basePath, "user.js"));
  }
}

export default ApiControllerV1;
