package fr.bglands.client.protocol;

import java.util.Objects;

public record FormField(String id, String label, String placeholder, int maxLength) {
    public FormField {
        Objects.requireNonNull(id, "id");
        Objects.requireNonNull(label, "label");
        placeholder = placeholder == null ? "" : placeholder;
        if (maxLength < 1 || maxLength > 1_024) {
            throw new IllegalArgumentException("maxLength must be in [1, 1024]");
        }
    }
}
