import { Controller, Get, Post, Param, Body, Query } from '@nestjs/common'
import { RetainerService } from './retainer.service'
import { CreateTransactionDto } from './dto/create-transaction.dto'

@Controller('client-folders/:clientFolderId/retainer')
export class RetainerController {
  constructor(private readonly service: RetainerService) {}

  @Get()
  getLedger(@Param('clientFolderId') clientFolderId: string) {
    return this.service.getLedger(clientFolderId)
  }

  @Post('transactions')
  addTransaction(
    @Param('clientFolderId') clientFolderId: string,
    @Body() dto: CreateTransactionDto,
  ) {
    return this.service.addTransaction(clientFolderId, dto)
  }

  @Get('balance')
  checkBalance(@Param('clientFolderId') clientFolderId: string) {
    return this.service.checkLowBalance(clientFolderId)
  }
}
