/**
 * @aurora-catalyst-generated
 * @source cliter/iam/user.aurora.yaml
 */
import { IamUpdateUserByIdDto } from '@api/iam/user';
import { IamResetPasswordUserHandler } from '@app/iam/user';
import { Auth } from '@aurora/decorators';
import { Auditing, AuditingMeta, Timezone } from '@aurorajs.dev/core-back';
import { QueryStatement } from '@aurorajs.dev/core-common';
import { Body, Controller, Post } from '@nestjs/common';
import { ApiCreatedResponse, ApiOperation, ApiTags } from '@nestjs/swagger';

@ApiTags('[iam] user')
@Controller('iam/user/reset-password')
@Auth('iam.user.update')
export class IamResetPasswordUserController {
  constructor(private readonly handler: IamResetPasswordUserHandler) {}

  @Post()
  @ApiOperation({ summary: 'reset-password user' })
  @ApiCreatedResponse({
    description: 'The operation has been successfully executed.',
    type: Boolean,
  })
  async main(
    @Body() payload: IamUpdateUserByIdDto,
    @Body('constraint') constraint?: QueryStatement,
    @Timezone() timezone?: string,
    @Auditing() auditing?: AuditingMeta,
  ) {
    return await this.handler.main(payload, constraint, {
      timezone,
      repositoryOptions: { auditing },
    });
  }
}
