Interface StockService

All Known Implementing Classes:
StockServiceImpl

public interface StockService
Service responsible for stock consultation per insumo and per batch (lote).

Business rules implemented:

  • Total stock = sum of cantidadActual across all lotes of an insumo.
  • Shortage risk = total stock < insumo's stockMinimoAlerta.
  • Method Details

    • getStockDetalladoPorInsumo

      StockInsumoResponse getStockDetalladoPorInsumo(Long insumoId)
      Returns the detailed stock for a single insumo, including its batch breakdown.
      Parameters:
      insumoId - the ID of the insumo
      Returns:
      stock detail with lote breakdown and shortage risk flag
      Throws:
      NotFoundException - if the insumo does not exist
    • getStockTodosInsumos

      List<StockInsumoResponse> getStockTodosInsumos()
      Returns the stock summary for every registered insumo.
    • getCoberturaTodosInsumos

      List<CoberturaInsumoResponse> getCoberturaTodosInsumos(int ventanaDias)
      Returns the estimated coverage days for every registered insumo.

      Coverage days = total stock / average daily consumption computed over the given ventanaDias window. If consumption is zero the result is Double.POSITIVE_INFINITY and the risk level is set to OK.

      Parameters:
      ventanaDias - sampling window in days (must be >= 1)