/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/authorization-code.aurora.yaml
 */
import { OAuthAuthorizationCode, OAuthUpdateAuthorizationCodeByIdInput } from '@api/graphql';
import { OAuthUpdateAuthorizationCodeByIdHandler } from '@app/o-auth/authorization-code';
import { Auth } from '@aurora/decorators';
import { Timezone } from '@aurorajs.dev/core-back';
import { QueryStatement } from '@aurorajs.dev/core-common';
import { Args, Mutation, Resolver } from '@nestjs/graphql';

@Resolver()
@Auth('oAuth.authorizationCode.update')
export class OAuthUpdateAuthorizationCodeByIdResolver {
  constructor(private readonly handler: OAuthUpdateAuthorizationCodeByIdHandler) {}

  @Mutation('oAuthUpdateAuthorizationCodeById')
  async main(
    @Args('payload') payload: OAuthUpdateAuthorizationCodeByIdInput,
    @Args('constraint') constraint?: QueryStatement,
    @Timezone() timezone?: string,
  ): Promise<OAuthAuthorizationCode> {
    return await this.handler.main(payload, constraint, {
      timezone,
    });
  }
}
