/**
 * @aurora-catalyst-generated
 * @source cliter/iam/role.aurora.yaml
 */
import { IamCreateRoleInput } from '@api/graphql';
import { IamCreateRolesHandler } from '@app/iam/role';
import { Auth } from '@aurora/decorators';
import { Auditing, AuditingMeta, Timezone } from '@aurorajs.dev/core-back';
import { Args, Mutation, Resolver } from '@nestjs/graphql';

@Resolver()
@Auth('iam.role.create')
export class IamCreateRolesResolver {
  constructor(private readonly handler: IamCreateRolesHandler) {}

  @Mutation('iamCreateRoles')
  async main(
    @Args('payload') payload: IamCreateRoleInput[],
    @Timezone() timezone?: string,
    @Auditing() auditing?: AuditingMeta,
  ): Promise<boolean> {
    return await this.handler.main(payload, {
      timezone,
      repositoryOptions: { auditing },
    });
  }
}
