//! Supported recording modes and user-facing refusal text.

pub fn is_supported(gamemode: &str) -> bool {
    matches!(gamemode, "40l" | "blitz")
}

pub fn unsupported_message(gamemode: &str) -> String {
    format!(
        "Cannot play recording mode '{gamemode}': only line-race and score-attack recordings are supported."
    )
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn only_line_race_and_score_attack_recordings_are_supported() {
        assert!(is_supported("40l"));
        assert!(is_supported("blitz"));
        assert!(!is_supported("endless"));
        assert!(!is_supported("pc"));
        assert!(!is_supported(""));
    }

    #[test]
    fn unsupported_message_names_the_mode() {
        let msg = unsupported_message("endless");
        assert!(msg.contains("endless"));
        assert!(msg.contains("line-race") && msg.contains("score-attack"));
    }
}
