package p.studio.lsp.messages;

import java.util.Objects;

public record LspServerEndpoint(
        String host,
        int port) {

    public LspServerEndpoint {
        final String candidate = Objects.requireNonNull(host, "host").trim();
        if (candidate.isEmpty()) {
            throw new IllegalArgumentException("host must not be blank");
        }
        if (port < 0 || port > 65535) {
            throw new IllegalArgumentException("port must be between 0 and 65535");
        }
        host = candidate;
    }
}
