package p.studio.lsp.messages;

import java.util.Objects;

public record BaselineServerDescription(
        String name,
        String version,
        boolean hoverSupported) {

    public BaselineServerDescription {
        name = requireText(name, "name");
        version = requireText(version, "version");
    }

    private static String requireText(
            final String value,
            final String field) {
        final String candidate = Objects.requireNonNull(value, field).trim();
        if (candidate.isEmpty()) {
            throw new IllegalArgumentException(field + " must not be blank");
        }
        return candidate;
    }
}
