/**
 * @aurora-catalyst-generated
 * @source cliter/iam/bounded-context.aurora.yaml
 */
import { IamBoundedContextDto } from '@api/iam/bounded-context';
import { IamDeleteBoundedContextByIdHandler } from '@app/iam/bounded-context';
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('[iam] bounded-context')
@Controller('iam/bounded-context/delete')
@Auth('iam.boundedContext.delete')
export class IamDeleteBoundedContextByIdController {
  constructor(private readonly handler: IamDeleteBoundedContextByIdHandler) {}

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