use std::fmt::Display; use async_trait::async_trait; use gamenight_api_client_rs::{apis::default_api::game_post, models::AddGameRequestBody}; use inquire::{Confirm, Text}; use super::*; #[derive(Clone)] pub struct AddGame { } impl AddGame { pub fn new() -> Self { Self {} } } #[async_trait] impl<'a> Flow<'a> for AddGame { async fn run(&self, state: &'a mut GamenightState) -> FlowResult<'a> { if let Some(name) = Text::new("What is the game you want to add").prompt_skippable()? { let add_game_request = AddGameRequestBody { name }; game_post(&state.api_configuration, Some(add_game_request)).await?; if let Some(owned) = Confirm::new("Do you own this game?").prompt_skippable()? { if owned { todo!() } } } Ok((FlowOutcome::Cancelled, state)) } } impl Display for AddGame { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "Add Game") } }