import { Controller } from '@nestjs/common';
import { AppService } from './app.service';

/**
 * Main application controller.
 * This is typically the root controller of a NestJS application.
 * In NestJS, controllers handle incoming HTTP requests and return responses.
 *
 * The @Controller() decorator without a path argument makes this the root controller,
 * handling requests to the base URL (e.g., http://localhost:3000/).
 *
 * @example
 * // HTTP GET request to http://localhost:3000/
 * // Would trigger the getHello() method if properly decorated
 *
 * @note This controller currently lacks HTTP method decorators (e.g., @Get()),
 * so none of its methods are exposed as endpoints. This might be intentional
 * if this is a base class or if methods are called internally.
 */
@Controller() // No path specified, so this is the root controller for the application
export class AppController {
  /**
   * Dependency injection of AppService.
   * NestJS automatically injects an instance of AppService.
   *
   * @param appService - Injected instance of AppService for business logic
   */
  constructor(private readonly appService: AppService) {}

  /**
   * Retrieves a greeting message from the application service.
   * This method is not currently exposed as an HTTP endpoint
   * because it lacks an HTTP method decorator like @Get().
   *
   * To expose this as an endpoint, add @Get() decorator:
   * @Get()
   * getHello() { ... }
   *
   * @returns {string} Greeting message from the application service
   *
   * @example
   * // If decorated with @Get():
   * // GET http://localhost:3000/ → "Hello World!"
   */
  getHello() {
    // Delegates to the AppService to get the greeting message
    return this.appService.getHello();
  }
}

/**
 * Complete example with HTTP decorator:
 *
 * import { Controller, Get } from '@nestjs/common';
 * import { AppService } from './app.service';
 *
 * @Controller()
 * export class AppController {
 *   constructor(private readonly appService: AppService) {}
 *
 *   @Get()
 *   getHello(): string {
 *     return this.appService.getHello();
 *   }
 * }
 *
 * Common HTTP method decorators:
 * - @Get(): Handle GET requests
 * - @Post(): Handle POST requests
 * - @Put(): Handle PUT requests
 * - @Delete(): Handle DELETE requests
 * - @Patch(): Handle PATCH requests
 *
 * With path specification:
 * @Controller('api') → All routes in this controller are prefixed with /api
 * @Get('hello') → Handles GET requests to /api/hello
 */
