import { Controller, Param, ParseUUIDPipe, Post } from '@nestjs/common';
import { ApiBearerAuth, ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger';

import { BookingPaymentService } from './booking-payment.service';
// import { BookingTransitionService } from './booking-transition.service';
// import { InAppPaymentReceiptDto } from './dto/pay-booking.dto';
// import { Booking } from './entities/booking.entity';
// import { BookingNextStep } from './booking-next-step.util';

@ApiTags('payments')
@ApiBearerAuth()
@Controller('bookings')
export class PayController {
  constructor(
    private readonly paymentService: BookingPaymentService,
    // private readonly transitionService: BookingTransitionService,
  ) { }

  @Post(':id/payment/pay')
  @ApiOperation({ summary: 'Complete in-app payment (mock)' })
  @ApiOkResponse({ description: 'Enriched booking with ephemeral payment receipt' })
  async pay(@Param('id', ParseUUIDPipe) id: string) {
    return await this.paymentService.pay(id);
    // const abstract = await this.transitionService.enrichBookingResponse(booking);
    // return { ...abstract, paymentReceipt: receipt };
  }
}
