package p.packer.messages;

import p.packer.dtos.PackerPackValidationAssetDTO;

import java.util.List;
import java.util.Objects;

public record ValidatePackWorkspaceResult(
        PackerOperationStatus status,
        String summary,
        List<PackerPackValidationAssetDTO> assets) {

    public ValidatePackWorkspaceResult {
        Objects.requireNonNull(status, "status");
        summary = Objects.requireNonNull(summary, "summary").trim();
        assets = List.copyOf(Objects.requireNonNull(assets, "assets"));
        if (summary.isBlank()) {
            throw new IllegalArgumentException("summary must not be blank");
        }
    }

    public boolean canPack() {
        return assets.isEmpty();
    }
}
