// Phase 9 content-tag extraction. Restricts the model output to a
// strict {topic, intent} JSON object where topic is a lowercase
// hyphen-joined slug of at least 3 chars (no upper bound is encoded
// in the grammar — max_tokens caps it in practice) and intent is one
// of the six closed-set values. Recursive `topic-rest` keeps the
// shape compatible with the existing GBNF style in this file.
pub const CONTENT_TAGS_GRAMMAR: &str = r##"
root        ::= "{" ws "\"topic\":" ws topic-str ws "," ws "\"intent\":" ws intent ws "}" ws
topic-str   ::= "\"" topic-char topic-char topic-char topic-rest "\""
topic-rest  ::= "" | topic-char topic-rest
topic-char  ::= [a-z0-9-]
intent      ::= "\"planning\"" | "\"reflection\"" | "\"venting\"" | "\"capture\"" | "\"decision\"" | "\"question\""
ws          ::= ([ \t\n] ws)?
"##;

pub const TASK_ARRAY_GRAMMAR: &str = r#"
root   ::= "[" ws string ws "," ws string ws "," ws string rest3 ws "]"
rest3  ::= "" | "," ws string rest4
rest4  ::= "" | "," ws string rest5
rest5  ::= "" | "," ws string rest6
rest6  ::= "" | "," ws string
string ::= "\"" chars "\"" ws
chars  ::= "" | char chars
char   ::= [^"\\\n\r] | "\\" escape
escape ::= ["\\/bfnrt] | "u" hex hex hex hex
hex    ::= [0-9a-fA-F]
ws     ::= ([ \t\n\r] ws)?
"#;

pub const OPTIONAL_TASK_ARRAY_GRAMMAR: &str = r#"
root   ::= "[" ws "]" | "[" ws string tail ws "]"
tail   ::= "" | "," ws string tail
string ::= "\"" chars "\"" ws
chars  ::= "" | char chars
char   ::= [^"\\\n\r] | "\\" escape
escape ::= ["\\/bfnrt] | "u" hex hex hex hex
hex    ::= [0-9a-fA-F]
ws     ::= ([ \t\n\r] ws)?
"#;
