/**
 * @aurora-catalyst-generated
 * @source cliter/iam/bounded-context.aurora.yaml
 */
import { IamBoundedContext, IamUpdateBoundedContextByIdInput } from '@api/graphql';
import { IamUpdateBoundedContextByIdHandler } 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 { Args, Mutation, Resolver } from '@nestjs/graphql';

@Resolver()
@Auth('iam.boundedContext.update')
export class IamUpdateBoundedContextByIdResolver {
  constructor(private readonly handler: IamUpdateBoundedContextByIdHandler) {}

  @Mutation('iamUpdateBoundedContextById')
  async main(
    @Args('payload') payload: IamUpdateBoundedContextByIdInput,
    @Args('constraint') constraint?: QueryStatement,
    @Timezone() timezone?: string,
    @Auditing() auditing?: AuditingMeta,
  ): Promise<IamBoundedContext> {
    return await this.handler.main(payload, constraint, {
      timezone,
      repositoryOptions: { auditing },
    });
  }
}
