import { Body, Controller, Delete, Post, Req, UseGuards } from '@nestjs/common';
import { DeviceTokenService } from './device-token.service';
import { JwtAuthGuard } from '@/auth/guards/jwt-auth/jwt-auth.guard';

@UseGuards(JwtAuthGuard)
@Controller('device-token')
export class DeviceTokenController {
  constructor(private readonly deviceTokenService: DeviceTokenService) {}

  @Post('save-device-token')
  async save(@Body() body, @Req() req) {
    return this.deviceTokenService.save(req.user.id, body.token, body.deviceId, body.platform);
  }

  @Delete('remove-device-token')
  remove(@Body() body: { deviceId: string }) {
    return this.deviceTokenService.remove(body.deviceId);
  }
}
