/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/client.aurora.yaml
 */
import { OAuthClient, OAuthUpdateClientByIdInput } from '@api/graphql';
import { OAuthUpdateClientByIdHandler } from '@app/o-auth/client';
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.client.update')
export class OAuthUpdateClientByIdResolver {
  constructor(private readonly handler: OAuthUpdateClientByIdHandler) {}

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