package p.packer.models;

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

public record PackerAssetIdentity(
        Integer assetId,
        String assetUuid,
        String assetName,
        Path assetRoot) {

    public PackerAssetIdentity {
        assetUuid = assetUuid == null ? null : assetUuid.trim();
        assetName = Objects.requireNonNull(assetName, "assetName").trim();
        assetRoot = Objects.requireNonNull(assetRoot, "assetRoot").toAbsolutePath().normalize();
        if (assetName.isBlank()) {
            throw new IllegalArgumentException("assetName must not be blank");
        }
    }
}
