import { Controller, Get, Param, Query } from '@nestjs/common';
import { FilterReconciliationDto } from './dto/filter-reconciliation.dto';
import { Pagination } from 'src/core/response';
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
import { ReconciliationReadOrchestrator } from '../domain/usecases/reconciliation-read.orchestrator';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
import { Public } from 'src/core/guards';
import { TransactionEntity } from '../../transaction/domain/entities/transaction.entity';

@ApiTags(`${MODULE_NAME.RECONCILIATION.split('-').join(' ')} - read`)
@Controller(`v1/${MODULE_NAME.RECONCILIATION}`)
@Public(false)
@ApiBearerAuth('JWT')
export class ReconciliationReadController {
  constructor(private orchestrator: ReconciliationReadOrchestrator) {}

  @Get()
  @Pagination()
  async index(
    @Query() params: FilterReconciliationDto,
  ): Promise<PaginationResponse<TransactionEntity>> {
    return await this.orchestrator.index(params);
  }

  @Get(':id')
  async detail(@Param('id') id: string): Promise<TransactionEntity> {
    return await this.orchestrator.detail(id);
  }
}
