package p.studio.debug.runtime;

public record StudioRuntimeDebugConnectionSettings(
        String host,
        int port) {
    public static final String DEFAULT_HOST = "127.0.0.1";
    public static final int DEFAULT_PORT = 7777;

    public StudioRuntimeDebugConnectionSettings {
        host = host == null || host.isBlank() ? DEFAULT_HOST : host.trim();
        if (port <= 0) {
            port = DEFAULT_PORT;
        }
    }

    public static StudioRuntimeDebugConnectionSettings defaults() {
        return new StudioRuntimeDebugConnectionSettings(DEFAULT_HOST, DEFAULT_PORT);
    }
}
