package p.studio.shipper;

import p.packer.messages.PackWorkspaceResult;
import p.packer.messages.ValidatePackWorkspaceResult;
import p.studio.compiler.models.BuildResult;

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

public record StudioShipperPrepareResult(
        StudioShipperPreparationStatus status,
        List<StudioShipperLogEntry> logs,
        BuildResult buildResult,
        ValidatePackWorkspaceResult validationResult,
        PackWorkspaceResult packResult,
        Path manifestPath) {

    public StudioShipperPrepareResult {
        Objects.requireNonNull(status, "status");
        logs = List.copyOf(Objects.requireNonNull(logs, "logs"));
        manifestPath = manifestPath == null ? null : manifestPath.toAbsolutePath().normalize();
    }

    public boolean success() {
        return status == StudioShipperPreparationStatus.SUCCESS;
    }
}
