use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum ActionInputFault {
ReservedField(String),
FileField(String),
RefusesEmpty,
DependentChoice(String),
}
pub(super) fn fmt_action_input(
f: &mut fmt::Formatter<'_>,
action: &str,
fault: &ActionInputFault,
) -> fmt::Result {
match fault {
ActionInputFault::ReservedField(field) => write!(
f,
"action '{action}' declares an input field named '{field}', which its POST \
carries itself: rename the field"
),
ActionInputFault::FileField(field) => write!(
f,
"action '{action}' declares a file field '{field}' in its input, which an \
action's POST does not upload: take the file in a record form"
),
ActionInputFault::RefusesEmpty => write!(
f,
"action '{action}' declares no input field, but its input refuses an empty \
submission: declare the fields it parses, or name `()`"
),
ActionInputFault::DependentChoice(field) => write!(
f,
"action '{action}' declares a dependent choice '{field}' in its input, whose \
options only a resource's form refreshes: drop `depends_on`"
),
}
}