import { Controller, Get, Req } from '@nestjs/common';
import { OpsPermissionAdapter } from './ops-permission.adapter';
import { OpsService } from './ops.service';

@Controller('ops')
export class OpsController {
  constructor(
    private readonly ops: OpsService,
    private readonly permissions: OpsPermissionAdapter,
  ) {}

  @Get('runtime')
  getRuntime(@Req() request: unknown) {
    this.permissions.assertCanViewOps(request);
    return this.ops.getRuntimeSnapshot();
  }
}
