use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[schemars(
title = "QuestionItem",
description = "One clarification question emitted by the assistant protocol payload. Keep \
each item focused to one actionable decision."
)]
pub struct QuestionItem {
#[serde(default)]
#[schemars(
title = "options",
description = "Predefined answer choices the user can select from. Keep this list focused \
to 1-3 likely answers, put the recommended choice first, and omit deferral \
or non-answer choices. Defaults to an empty list when omitted."
)]
pub options: Vec<String>,
#[schemars(
title = "text",
description = "Human-readable markdown text for this question. Ask one specific \
actionable question instead of bundling multiple decisions into one item."
)]
pub text: String,
}
impl QuestionItem {
pub fn new(text: impl Into<String>) -> Self {
Self {
options: Vec::new(),
text: text.into(),
}
}
pub fn with_options(text: impl Into<String>, options: Vec<String>) -> Self {
Self {
options,
text: text.into(),
}
}
}