import { Controller, Get, Param, UseGuards } from '@nestjs/common';
import { RidersService } from './riders.service';
import { MessagePattern } from '@nestjs/microservices';
import { JwtAuthGuard } from 'libs/auth-core-lib/src/guards/jwt-auth-guard';

@Controller('rider')
export class RidersController {
  constructor(private readonly ridersService: RidersService) {}

  @Get()
  @UseGuards(JwtAuthGuard)
  getHello(): string {
    return this.ridersService.getHello();
  }

  // @Get(':id')

  @MessagePattern({ cmd: 'get-rider' })
  getRiderById(data: any) {
    return Promise.resolve({
      id: data.id,
      first_name: 'isuru',
      second_name: 'chandika',
      email: 'isuruchandika321@gmail.com',
    });
  }
}
