package p.packer.dtos;

import java.nio.file.Path;
import java.util.Objects;

public record PackerEmittedArtifactDTO(
        String label,
        Path path,
        boolean canonical,
        long sizeBytes) {

    public PackerEmittedArtifactDTO {
        label = Objects.requireNonNull(label, "label").trim();
        path = Objects.requireNonNull(path, "path").toAbsolutePath().normalize();
        if (label.isBlank()) {
            throw new IllegalArgumentException("label must not be blank");
        }
        if (sizeBytes < 0L) {
            throw new IllegalArgumentException("sizeBytes must not be negative");
        }
    }
}
