package fr.bglands.client.protocol;

import java.util.List;
import java.util.Objects;

public record ClientHello(
        int protocolMajor,
        int protocolMinor,
        String modVersion,
        List<String> capabilities
) {
    public ClientHello {
        Objects.requireNonNull(modVersion, "modVersion");
        capabilities = List.copyOf(capabilities);
    }

    public static ClientHello current(String modVersion) {
        return new ClientHello(
                ProtocolConstants.PROTOCOL_MAJOR,
                ProtocolConstants.PROTOCOL_MINOR,
                modVersion,
                List.of(ProtocolConstants.SCREEN_V1_CAPABILITY, ProtocolConstants.FORM_V1_CAPABILITY)
        );
    }
}
