/**
 * @aurora-catalyst-generated
 * @source cliter/iam/tenant.aurora.yaml
 */
import { IamTenantDto } from '@api/iam/tenant';
import { IamDeleteTenantByIdHandler } from '@app/iam/tenant';
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] tenant')
@Controller('iam/tenant/delete')
@Auth('iam.tenant.delete')
export class IamDeleteTenantByIdController {
  constructor(private readonly handler: IamDeleteTenantByIdHandler) {}

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