/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/scope.aurora.yaml
 */
import { OAuthScopeDto } from '@api/o-auth/scope';
import { OAuthFindScopeByIdHandler } from '@app/o-auth/scope';
import { Auth } from '@aurora/decorators';
import { Timezone } from '@aurorajs.dev/core-back';
import { QueryStatement } from '@aurorajs.dev/core-common';
import { Body, Controller, HttpCode, Param, Post } from '@nestjs/common';
import { ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger';

@ApiTags('[o-auth] scope')
@Controller('o-auth/scope/find')
@Auth('oAuth.scope.get')
export class OAuthFindScopeByIdController {
  constructor(private readonly handler: OAuthFindScopeByIdHandler) {}

  @Post(':id')
  @HttpCode(200)
  @ApiOperation({ summary: 'Find scope by id' })
  @ApiOkResponse({
    description: 'The record has been successfully requested.',
    type: OAuthScopeDto,
  })
  async main(
    @Param('id') id: string,
    @Body('constraint') constraint?: QueryStatement,
    @Timezone() timezone?: string,
  ) {
    return await this.handler.main(id, constraint, {
      timezone,
    });
  }
}
