/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/application-client.aurora.yaml
 */
import {
  OAuthApplicationClientDto,
  OAuthCreateApplicationClientDto,
} from '@api/o-auth/application-client';
import { OAuthCreateApplicationClientHandler } from '@app/o-auth/application-client';
import { Auth } from '@aurora/decorators';
import { Auditing, AuditingMeta, Timezone } from '@aurorajs.dev/core-back';
import { Body, Controller, Post } from '@nestjs/common';
import { ApiCreatedResponse, ApiOperation, ApiTags } from '@nestjs/swagger';

@ApiTags('[o-auth] application-client')
@Controller('o-auth/application-client/create')
@Auth('oAuth.applicationClient.create')
export class OAuthCreateApplicationClientController {
  constructor(private readonly handler: OAuthCreateApplicationClientHandler) {}

  @Post()
  @ApiOperation({ summary: 'Create application-client' })
  @ApiCreatedResponse({
    description: 'The record has been successfully created.',
    type: OAuthApplicationClientDto,
  })
  async main(
    @Body() payload: OAuthCreateApplicationClientDto,
    @Timezone() timezone?: string,
    @Auditing() auditing?: AuditingMeta,
  ) {
    return await this.handler.main(payload, {
      timezone,
      repositoryOptions: { auditing },
    });
  }
}
