import { Controller, Put, Body, UseGuards, Get } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
import { JwtAuthGuard } from '@/common/guards/jwt-auth.guard';
import { RolesGuard } from '@/common/guards/roles.guard';
import { Roles } from '@/common/decorators/roles.decorator';
import { WebsiteInfoService } from '@/modules/website/info/info.service';
import { UpdateWebsiteInfoDto } from '@/modules/website/info/dto/website-info.dto';

@ApiTags('网站管理')
@Controller('admin/website/info')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('admin')
@ApiBearerAuth()
export class AdminWebsiteController {
  constructor(private readonly websiteInfoService: WebsiteInfoService) {}

  @Get()
  @ApiOperation({ summary: '获取网站信息' })
  async getInfo() {
    return this.websiteInfoService.getInfo();
  }

  @Put()
  @ApiOperation({ summary: '更新网站信息' })
  async updateInfo(@Body() data: UpdateWebsiteInfoDto) {
    return this.websiteInfoService.updateInfo(data);
  }
}
