import { Controller, Get, Query } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiQuery, ApiResponse } from '@nestjs/swagger';
import { LandingPagesService } from './landing-pages.service';

/**
 * LandingPagesController - Controller for landing page-specific content
 *
 * This controller handles endpoints for specialized content used on
 * landing pages, promotional pages, and other focused entry points.
 * Currently focused on university/partner logos but can be extended
 * for other landing page components.
 *
 * All endpoints are publicly accessible and designed for high-performance
 * content delivery with caching support.
 *
 * @example
 * // Get university logos for a specific landing page
 * GET /university-logos?pageType=student_visa&visaProductCountryId=44
 *
 * @example
 * // Get all active university logos
 * GET /university-logos
 */
@ApiTags('Landing Pages') // Groups endpoints under 'Landing Pages' in Swagger UI
@Controller('') // Empty controller path means routes are at root level
export class LandingPagesController {
  /**
   * Creates an instance of LandingPagesController
   *
   * @param service - LandingPagesService for business logic
   */
  constructor(private readonly service: LandingPagesService) {}

  /**
   * Get active university/partner logos
   *
   * Retrieves logos of universities, partners, or associated institutions
   * for display on landing pages. Supports filtering by page context
   * and country-specific content.
   *
   * Common use cases:
   * - University partner logos on student visa landing pages
   * - Corporate partner logos on business service pages
   * - Association logos on certification pages
   *
   * @param pageType - The specific landing page type (e.g., 'student_visa', 'work_permit')
   * @param visaProductCountryId - Optional country ID for country-specific logos
   * @returns Array of logo data (typically images and titles)
   *
   * @example
   * // Get logos for UK student visa landing page
   * GET /university-logos?pageType=student_visa&visaProductCountryId=44
   */
  @Get('university-logos')
  @ApiOperation({
    summary: 'Get university/partner logos',
    description:
      'Retrieve active logos of universities, partners, or associated institutions for landing pages',
  })
  @ApiQuery({
    name: 'pageType',
    required: false,
    description:
      'Landing page type (e.g., student_visa, work_permit, business_immigration)',
    example: 'student_visa',
  })
  @ApiQuery({
    name: 'visaProductCountryId',
    required: false,
    description: 'Country ID for country-specific logos',
    example: 44,
    type: Number,
  })
  @ApiResponse({
    status: 200,
    description: 'University logos retrieved successfully',
    schema: {
      example: [
        {
          id: 1,
          image: 'university-logo-1.png',
          title: 'University of Example',
          pageType: 'student_visa',
          countryId: 44,
        },
      ],
    },
  })
  @ApiResponse({ status: 500, description: 'Internal server error' })
  async getActiveLogos(
    @Query('pageType') pageType?: string,
    @Query('visaProductCountryId') visaProductCountryId?: number,
  ) {
    return this.service.getAllUniversityLogosShortActiveFrontend(
      pageType,
      visaProductCountryId,
    );
  }

  // Additional endpoints that could be added in the future:

  /**
   * Example: Get landing page testimonials
   * @Get('landing-testimonials')
   * async getLandingTestimonials(@Query('pageType') pageType?: string) {
   *   return this.service.getLandingTestimonials(pageType);
   * }
   *
   * Example: Get landing page statistics
   * @Get('landing-stats')
   * async getLandingStats(@Query('pageType') pageType?: string) {
   *   return this.service.getLandingPageStatistics(pageType);
   * }
   *
   * Example: Get landing page call-to-action content
   * @Get('landing-cta')
   * async getLandingCTA(@Query('pageType') pageType?: string) {
   *   return this.service.getCallToActionContent(pageType);
   * }
   */
}
