/**
 * @aurora-catalyst-generated
 * @source cliter/iam/user.aurora.yaml
 */
import { IamUser } from '@api/graphql';
import { IamDeleteUsersHandler } from '@app/iam/user';
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.user.delete')
export class IamDeleteUsersResolver {
  constructor(private readonly handler: IamDeleteUsersHandler) {}

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