import { Controller, Get, UseGuards } from "@nestjs/common";
import { ApiOperation, ApiTags } from "@nestjs/swagger";

import { PermissionGuard } from "@tria-plc/api-common/modules/auth/services/permission.guard";

@ApiTags("demo-permissions")
@Controller()
export class DemoPermissionsController {
  @Get("test_user1")
  @ApiOperation({ summary: "Permission demo (can:demo:user1)" })
  @UseGuards(PermissionGuard(["can:demo:user1"]))
  testUser1() {
    return { ok: true, permission: "can:demo:user1" };
  }

  @Get("test_user2")
  @ApiOperation({ summary: "Permission demo (can:demo:user2)" })
  @UseGuards(PermissionGuard(["can:demo:user2"]))
  testUser2() {
    return { ok: true, permission: "can:demo:user2" };
  }
}
