import { Controller, Get, UseGuards } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import type { LoginUserInfo } from 'src/auth/dto/login.dto';
import { GetUser } from 'src/auth/get-user.decorator';
import { MobileDashboardService } from './mobile-dashboard.service';

/** Home del cobrador: estado de caja + cotizaciones del día + flags de rendición. */
@ApiTags('Mobile · Dashboard')
@ApiBearerAuth()
@UseGuards(AuthGuard('jwt'))
@Controller({ path: 'mobile/dashboard', version: '1' })
export class MobileDashboardController {
  constructor(private readonly dashboard: MobileDashboardService) {}

  @Get()
  @ApiOperation({ summary: 'Datos del Home: caja abierta, cotizaciones y rendición pendiente' })
  get(@GetUser() user: LoginUserInfo) {
    return this.dashboard.get(user.empresa_id, user.id);
  }
}
