import { Controller, Get, Res, UseGuards } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { ApiBearerAuth, ApiCreatedResponse } from '@nestjs/swagger';
import type { Response } from 'express';
import { response_ref } from './dto/doc-swagger';
import { ReferencialesService } from './referenciales.service';

@Controller({ path: 'referenciales', version: '1' })
export class ReferencialesController {
  constructor(private readonly referencialesService: ReferencialesService) {}

  @Get()
  @UseGuards(AuthGuard('jwt'))
  @ApiBearerAuth()
  @ApiCreatedResponse(response_ref)
  async findAll(@Res() response: Response) {
    const responseRef = await this.referencialesService.findAll();
    return response.status(200).json(responseRef);
  }
}
