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

import de.effigenix.domain.production.Consumption;

import java.time.OffsetDateTime;

public record ConsumptionResponse(
        String id,
        String inputBatchId,
        String articleId,
        String quantityUsed,
        String quantityUsedUnit,
        OffsetDateTime consumedAt
) {
    public static ConsumptionResponse from(Consumption consumption) {
        return new ConsumptionResponse(
                consumption.id().value(),
                consumption.inputBatchId().value(),
                consumption.articleId().value(),
                consumption.quantityUsed().amount().toPlainString(),
                consumption.quantityUsed().uom().name(),
                consumption.consumedAt()
        );
    }
}
