/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/scope.aurora.yaml
 */
import { OAuthScope, OAuthUpdateScopeByIdInput } from '@api/graphql';
import { OAuthUpdateScopeByIdHandler } from '@app/o-auth/scope';
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('oAuth.scope.update')
export class OAuthUpdateScopeByIdResolver {
  constructor(private readonly handler: OAuthUpdateScopeByIdHandler) {}

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