package de.effigenix.infrastructure.inventory.web.dto;

import de.effigenix.domain.inventory.StockBatch;

import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;

public record StockBatchResponse(
        String id,
        String batchId,
        String batchType,
        BigDecimal quantityAmount,
        String quantityUnit,
        LocalDate expiryDate,
        String status,
        Instant receivedAt
) {

    public static StockBatchResponse from(StockBatch batch) {
        return new StockBatchResponse(
                batch.id().value(),
                batch.batchReference().batchId(),
                batch.batchReference().batchType().name(),
                batch.quantity().amount(),
                batch.quantity().uom().name(),
                batch.expiryDate(),
                batch.status().name(),
                batch.receivedAt()
        );
    }
}
