/**
 * @aurora-catalyst-generated
 * @source cliter/iam/bounded-context.aurora.yaml
 */
import { IamBoundedContextDto, IamUpdateBoundedContextsDto } from '@api/iam/bounded-context';
import { IamUpdateBoundedContextsHandler } 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, Put } from '@nestjs/common';
import { ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger';

@ApiTags('[iam] bounded-context')
@Controller('iam/bounded-contexts/update')
@Auth('iam.boundedContext.update')
export class IamUpdateBoundedContextsController {
  constructor(private readonly handler: IamUpdateBoundedContextsHandler) {}

  @Put()
  @ApiOperation({ summary: 'Update bounded-contexts' })
  @ApiOkResponse({
    description: 'The record has been successfully updated.',
    type: IamBoundedContextDto,
  })
  async main(
    @Body('payload') payload: IamUpdateBoundedContextsDto,
    @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 },
    });
  }
}
