/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/application.aurora.yaml
 */
import { OAuthApplicationDto } from '@api/o-auth/application';
import { OAuthDeleteApplicationByIdHandler } from '@app/o-auth/application';
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] application')
@Controller('o-auth/application/delete')
@Auth('oAuth.application.delete')
export class OAuthDeleteApplicationByIdController {
  constructor(private readonly handler: OAuthDeleteApplicationByIdHandler) {}

  @Delete(':id')
  @ApiOperation({ summary: 'Delete application by id' })
  @ApiOkResponse({
    description: 'The record has been deleted successfully.',
    type: OAuthApplicationDto,
  })
  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 },
    });
  }
}
