/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/application.aurora.yaml
 */
import { OAuthApplication, OAuthCreateApplicationInput } from '@api/graphql';
import { OAuthCreateApplicationHandler } from '@app/o-auth/application';
import { Auth } from '@aurora/decorators';
import { Auditing, AuditingMeta, Timezone } from '@aurorajs.dev/core-back';
import { Args, Mutation, Resolver } from '@nestjs/graphql';

@Resolver()
@Auth('oAuth.application.create')
export class OAuthCreateApplicationResolver {
  constructor(private readonly handler: OAuthCreateApplicationHandler) {}

  @Mutation('oAuthCreateApplication')
  async main(
    @Args('payload') payload: OAuthCreateApplicationInput,
    @Timezone() timezone?: string,
    @Auditing() auditing?: AuditingMeta,
  ): Promise<OAuthApplication> {
    return await this.handler.main(payload, {
      timezone,
      repositoryOptions: { auditing },
    });
  }
}
