/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/credential.aurora.yaml
 */
import { OAuthCredential } from '@api/graphql';
import { OAuthFindCredentialByIdHandler } from '@app/o-auth/credential';
import { Auth } from '@aurora/decorators';
import { Timezone } from '@aurorajs.dev/core-back';
import { QueryStatement } from '@aurorajs.dev/core-common';
import { Args, Query, Resolver } from '@nestjs/graphql';

@Resolver()
@Auth('oAuth.credential.get')
export class OAuthFindCredentialByIdResolver {
  constructor(private readonly handler: OAuthFindCredentialByIdHandler) {}

  @Query('oAuthFindCredentialById')
  async main(
    @Args('id') id: string,
    @Args('constraint') constraint?: QueryStatement,
    @Timezone() timezone?: string,
  ): Promise<OAuthCredential> {
    return await this.handler.main(id, constraint, {
      timezone,
    });
  }
}
