package p.studio.lsp.events;

import java.util.Objects;

public record StudioProjectLoadingProgressEvent(
        StudioProjectLoadingPhase phase,
        String message,
        double progress,
        boolean indeterminate) implements StudioEvent {

    public StudioProjectLoadingProgressEvent {
        Objects.requireNonNull(phase, "phase");
        Objects.requireNonNull(message, "message");
        if (!indeterminate && (progress < 0.0d || progress > 1.0d)) {
            throw new IllegalArgumentException("progress must be between 0.0 and 1.0 when determinate");
        }
    }
}
