import { Controller, Get, Put, Body, Req, UseGuards } from '@nestjs/common';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
import { SeekerSocialLinksService } from './seeker_social_links.service';
import { ApiBearerAuth, ApiTags, ApiOperation } from '@nestjs/swagger';
import { Public } from '../auth/public.decorator';

@ApiTags('seekerSocialLinks')
@ApiBearerAuth('access-token')
@Controller('seekerSocialLinks')
export class SeekerSocialLinksController {
  constructor(
    private readonly seekerSocialLinksService: SeekerSocialLinksService,
  ) {}

  @Public()
  @Get()
  @ApiOperation({ summary: 'Get all seeker social links' })
  async findAll() {
    return this.seekerSocialLinksService.findAll();
  }

  @UseGuards(JwtAuthGuard)
  @Put('me')
  @ApiOperation({ summary: 'Update seeker social links' })
  async updateSocialLinks(@Req() req: any, @Body() links: any[]) {
    const userId = req.user?.id || req.user?.userId || req.user?.sub;
    return this.seekerSocialLinksService.updateSocialLinks(userId, links);
  }
}
