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

import { Request, Response } from "express";

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

export class UserApiControllerV1 extends DtpController {
  get name(): string {
    return "UserApiControllerV1";
  }
  get slug(): string {
    return "userV1";
  }
  get route(): string {
    return "/user";
  }

  constructor() {
    super();
  }

  async start(): Promise<void> {
    this.router.use(this.requireUser());

    this.router.get("/", this.getUser.bind(this));
  }

  async getUser(req: Request, res: Response): Promise<void> {
    res.status(200).json({
      success: true,
      data: {
        user: req.user,
      },
    });
  }
}

export default UserApiControllerV1;
