1//! The "does any label fit at all" Noul (contract *SQL surface*, the
2//! vendor's `gate` / `exists` pattern): asked beside a label-tree or
3//! shortlist search's first round, in the same request.
4//!
5//! A Choice's probabilities always sum to 1, so some label wins even when
6//! none fits. The gate's probability does not depend on the other
7//! options, so it can fall near zero when nothing fits. It never ranks
8//! labels: Noul and Choice scores are not comparable.
9
10use jev_protocol::{Json, Noul};
11
12/// The gate over labels shown as `labels`. Every piece is fixed, so equal
13/// label sets give equal bytes and one cache key.
14pub(crate) fn gate(question: &str, labels: &str) -> Noul {
15    Noul::new(Json::text(&format!("{question}\n\nDoes any of these labels fit? {labels}")))
16        .yes_means(Json::text("At least one of the labels fits"))
17        .no_means(Json::text("None of the labels fits"))
18}