/**
 * @aurora-catalyst-generated
 * @source cliter/iam/tenant-account.aurora.yaml
 */
import { IamTenantAccount, IamUpdateTenantsAccountsInput } from '@api/graphql';
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 { Args, Mutation, Resolver } from '@nestjs/graphql';

@Resolver()
@Auth('iam.tenantAccount.update')
export class IamUpdateTenantsAccountsResolver {
  constructor(private readonly handler: IamUpdateTenantsAccountsHandler) {}

  @Mutation('iamUpdateTenantsAccounts')
  async main(
    @Args('payload') payload: IamUpdateTenantsAccountsInput,
    @Args('query') queryStatement?: QueryStatement,
    @Args('constraint') constraint?: QueryStatement,
    @Timezone() timezone?: string,
    @Auditing() auditing?: AuditingMeta,
  ): Promise<IamTenantAccount[]> {
    return await this.handler.main(payload, queryStatement, constraint, {
      timezone,
      repositoryOptions: { auditing },
    });
  }
}
