/**
 * @aurora-catalyst-generated
 * @source cliter/iam/tenant-account.aurora.yaml
 */
import { IamTenantAccountDto, IamUpdateTenantsAccountsDto } from '@api/iam/tenant-account';
import { IamUpdateTenantsAccountsHandler } from '@app/iam/tenant-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, Put } from '@nestjs/common';
import { ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger';

@ApiTags('[iam] tenant-account')
@Controller('iam/tenants-accounts/update')
@Auth('iam.tenantAccount.update')
export class IamUpdateTenantsAccountsController {
  constructor(private readonly handler: IamUpdateTenantsAccountsHandler) {}

  @Put()
  @ApiOperation({ summary: 'Update tenants-accounts' })
  @ApiOkResponse({
    description: 'The record has been successfully updated.',
    type: IamTenantAccountDto,
  })
  async main(
    @Body('payload') payload: IamUpdateTenantsAccountsDto,
    @Body('query') queryStatement?: QueryStatement,
    @Body('constraint') constraint?: QueryStatement,
    @Timezone() timezone?: string,
    @Auditing() auditing?: AuditingMeta,
  ) {
    return await this.handler.main(payload, queryStatement, constraint, {
      timezone,
      repositoryOptions: { auditing },
    });
  }
}
