use std::collections::HashMap; use serde::{Deserialize, Serialize}; use uuid::Uuid; #[derive(Serialize, Deserialize, Clone, Debug)] pub struct LoginRequest { pub username: String, pub password: String, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct LoginResponse { pub token: String, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct EmptyResponse {} #[derive(Serialize, Deserialize, Clone, Debug)] pub struct Household { pub name: String, pub members: Vec, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct Households { pub households: HashMap, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct CreateHouseholdRequest { pub name: String, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct CreateHouseholdResponse { pub id: Uuid, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct RenameHouseholdRequest { pub name: String, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct AddToHouseholdRequest { pub user: Uuid, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct UserInfo { pub name: String, pub id: Uuid, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct CreateIngredientRequest { pub name: String, pub unit: Option, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct CreateIngredientResponse { pub id: i64, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct IngredientInfo { pub name: String, pub unit: Option, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct IngredientList { pub ingredients: HashMap, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct EditIngredientRequest { pub name: Option, pub unit: Option, #[serde(default)] pub has_unit: bool, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct CreateRecipeRequest { pub person_count: u32, pub name: String, pub rating: u8, pub ingredients: Vec<(i64, f64)>, pub steps: String, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct CreateRecipeResponse { pub id: i64, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct ListRecipesResponse { pub recipes: Vec<(i64, String, u8)>, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct RecipeInfo { pub name: String, pub rating: u8, pub person_count: u32, pub steps: String, pub ingredients: Vec<(i64, IngredientInfo, f64)>, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct RecipeRenameRequest { pub name: String, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct RecipeIngredientEditRequest { pub amount: f64, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct AddRecipeIngredientRequest { pub amount: f64, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct RecipeEditStepsRequest { pub steps: String } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct RecipeEditRating { pub rating: u8, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct RecipeEditPersonCount { pub person_count: u32, }