import { Body, Controller, Get, Headers, Post } from '@nestjs/common';
import { AuthService, LoginDto } from './auth.service';

@Controller('auth')
export class AuthController {
  constructor(private readonly authService: AuthService) {}

  @Post('login')
  login(@Body() loginDto: LoginDto) {
    return this.authService.login(loginDto);
  }

  @Get('me')
  me(@Headers('authorization') authorizationHeader?: string) {
    return this.authService.getSession(authorizationHeader);
  }

  @Get('permissions')
  permissions() {
    return this.authService.getRolePermissions();
  }
}

