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

@Resolver()
@Auth('oAuth.authorizationCode.create')
export class OAuthCreateAuthorizationCodeResolver {
  constructor(private readonly handler: OAuthCreateAuthorizationCodeHandler) {}

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