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

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