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

@ApiTags('[o-auth] scope')
@Controller('o-auth/scope/delete')
@Auth('oAuth.scope.delete')
export class OAuthDeleteScopeByIdController {
  constructor(private readonly handler: OAuthDeleteScopeByIdHandler) {}

  @Delete(':id')
  @ApiOperation({ summary: 'Delete scope by id' })
  @ApiOkResponse({ description: 'The record has been deleted successfully.', type: OAuthScopeDto })
  async main(
    @Param('id') id: string,
    @Body('constraint') constraint?: QueryStatement,
    @Timezone() timezone?: string,
    @Auditing() auditing?: AuditingMeta,
  ) {
    return await this.handler.main(id, constraint, {
      timezone,
      repositoryOptions: { auditing },
    });
  }
}
