package p.packer.models;

import java.util.Objects;

public record PackerRegistryEntry(
        int assetId,
        String assetUuid,
        String root,
        boolean includedInBuild) {

    public PackerRegistryEntry(int assetId, String assetUuid, String root) {
        this(assetId, assetUuid, root, true);
    }

    public PackerRegistryEntry {
        assetUuid = Objects.requireNonNull(assetUuid, "assetUuid").trim();
        root = Objects.requireNonNull(root, "root").trim();
        if (assetId <= 0) {
            throw new IllegalArgumentException("assetId must be positive");
        }
        if (assetUuid.isBlank() || root.isBlank()) {
            throw new IllegalArgumentException("assetUuid and root must not be blank");
        }
    }
}
