import { Injectable } from '@nestjs/common';

/**
 * Main application service.
 *
 * This service serves as the root service of the NestJS application.
 * In NestJS architecture, services are responsible for business logic,
 * data processing, and application functionality, while controllers
 * handle HTTP requests and responses.
 *
 * The @Injectable() decorator marks this class as a provider that can
 * be injected into controllers or other services through NestJS's
 * dependency injection system.
 *
 * This is typically the default service generated by the NestJS CLI
 * and can be extended with additional business logic as the application grows.
 *
 * @example
 * // In AppController:
 * @Controller()
 * export class AppController {
 *   constructor(private readonly appService: AppService) {}
 *
 *   @Get()
 *   getHello(): string {
 *     return this.appService.getHello();
 *   }
 * }
 */
@Injectable() // Marks this class as injectable for NestJS's dependency injection
export class AppService {
  /**
   * Returns a basic greeting message.
   *
   * This method demonstrates a simple service function that can be called
   * by controllers or other services. In a real application, this would
   * typically be replaced with more complex business logic.
   *
   * @returns {string} A simple greeting message
   *
   * @example
   * // Basic usage
   * const greeting = appService.getHello(); // Returns: 'Hello World!'
   *
   * @example
   * // In a controller endpoint
   * @Get()
   * getWelcome() {
   *   return this.appService.getHello(); // Returns 'Hello World!' to HTTP client
   * }
   *
   * @note
   * This is often used as a health check or welcome endpoint in APIs.
   */
  getHello(): string {
    return 'Hello World!';
  }
}

/**
 * Typical evolution of AppService in a real-world application:
 *
 * 1. Initial setup (current):
 *    - Simple greeting method
 *
 * 2. Extended with business logic:
 *    - User management methods
 *    - Data processing functions
 *    - External API integrations
 *
 * 3. With database integration:
 *    import { InjectRepository } from '@nestjs/typeorm';
 *    import { Repository } from 'typeorm';
 *    import { User } from './user.entity';
 *
 *    @Injectable()
 *    export class AppService {
 *      constructor(
 *        @InjectRepository(User)
 *        private usersRepository: Repository<User>,
 *      ) {}
 *
 *      async getHello(): Promise<string> {
 *        const userCount = await this.usersRepository.count();
 *        return `Hello World! There are ${userCount} users.`;
 *      }
 *    }
 *
 * 4. With configuration:
 *    import { ConfigService } from '@nestjs/config';
 *
 *    @Injectable()
 *    export class AppService {
 *      constructor(private configService: ConfigService) {}
 *
 *      getHello(): string {
 *        const appName = this.configService.get<string>('APP_NAME');
 *        return `Hello from ${appName}!`;
 *      }
 *    }
 *
 * 5. With logging:
 *    import { Logger } from '@nestjs/common';
 *
 *    @Injectable()
 *    export class AppService {
 *      private readonly logger = new Logger(AppService.name);
 *
 *      getHello(): string {
 *        this.logger.log('getHello method called');
 *        return 'Hello World!';
 *      }
 *    }
 */
