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

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