package fr.bglands.client.protocol;

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

public record OpenForm(
        int protocolMajor,
        String instanceId,
        String route,
        String title,
        String instruction,
        List<FormField> fields,
        String submitToken
) implements ServerMessage {
    public OpenForm {
        Objects.requireNonNull(instanceId, "instanceId");
        Objects.requireNonNull(route, "route");
        title = title == null ? "" : title;
        instruction = instruction == null ? "" : instruction;
        fields = List.copyOf(fields);
        Objects.requireNonNull(submitToken, "submitToken");
    }
}
