import { Controller, Get, Put, Body, UseGuards } from '@nestjs/common';
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
import { ProfileService } from './profile.service';
import { JwtAuthGuard } from '../common/guards/jwt-auth.guard';
import { RolesGuard } from '../common/guards/roles.guard';
import { Roles } from '../common/decorators/roles.decorator';

@ApiTags('Profile')
@Controller()
export class ProfileController {
  constructor(private profileService: ProfileService) {}

  @Get('profile')
  getProfile() {
    return this.profileService.get();
  }

  @ApiBearerAuth()
  @UseGuards(JwtAuthGuard, RolesGuard)
  @Roles('SUPER_ADMIN', 'ADMIN')
  @Get('admin/profile')
  getAdminProfile() {
    return this.profileService.get();
  }

  @ApiBearerAuth()
  @UseGuards(JwtAuthGuard, RolesGuard)
  @Roles('SUPER_ADMIN', 'ADMIN')
  @Put('admin/profile')
  upsert(@Body() data: {
    description?: string;
    vision?: string;
    mission?: string;
    motto?: string;
    values?: string;
    accreditation?: string;
    history?: string;
  }) {
    return this.profileService.upsert(data);
  }
}
