package de.effigenix.domain.inventory;

import de.effigenix.shared.common.Result;

public record MinimumShelfLife(int days) {

    public static Result<StockError, MinimumShelfLife> of(Integer days) {
        if (days == null || days <= 0) {
            return Result.failure(new StockError.InvalidMinimumShelfLife(days == null ? 0 : days));
        }
        return Result.success(new MinimumShelfLife(days));
    }
}
