import { Inject } from '@nestjs/common';
import { QueryHandler, type IQueryHandler } from '@nestjs/cqrs';
import { ADMIN_QUERY_REPOSITORY, type IAdminQueryRepository, type KycQueueResult } from '../../../domain/repositories/admin-query.repository';
import { GetKycQueueQuery } from './get-kyc-queue.query';

@QueryHandler(GetKycQueueQuery)
export class GetKycQueueHandler implements IQueryHandler<GetKycQueueQuery> {
  constructor(
    @Inject(ADMIN_QUERY_REPOSITORY) private readonly adminQueryRepo: IAdminQueryRepository,
  ) {}

  async execute(query: GetKycQueueQuery): Promise<KycQueueResult> {
    return this.adminQueryRepo.getKycQueue(query.page, query.limit);
  }
}
