2023-08-26 06:36:12 +02:00
use std ::collections ::HashMap ;
use serde ::{ Serialize , Deserialize } ;
use utoipa ::{ ToSchema , IntoParams } ;
#[ derive(Serialize, Deserialize, ToSchema, Debug, IntoParams) ]
2023-08-30 04:16:43 +02:00
pub struct AuthParamsOptional {
#[ schema(example = " 1357 " ) ]
2023-08-26 06:36:12 +02:00
pub token : Option < String > ,
}
2023-08-30 04:16:43 +02:00
#[ derive(Serialize, Deserialize, ToSchema, Debug, IntoParams) ]
pub struct AuthParams {
#[ schema(example = " 1357 " ) ]
pub token : String ,
}
#[ derive(Serialize, Deserialize, ToSchema, Debug) ]
pub struct AuthReturn {
#[ schema(example = false) ]
pub moderator : bool ,
#[ schema(example = false) ]
pub admin : bool ,
}
#[ derive(Serialize, Deserialize, ToSchema, Debug, IntoParams) ]
pub struct GetGameParam {
pub game_id : Option < usize > ,
}
#[ derive(Serialize, Deserialize, ToSchema, Debug) ]
pub struct PostGameParams {
pub auth : AuthParams ,
#[ schema(example = " Game XY " ) ]
pub game_name : String ,
}
#[ derive(Serialize, Deserialize, ToSchema, Debug, IntoParams) ]
pub struct DeleteGameParam {
#[ schema(example = 0) ]
pub game_id : usize ,
}
2023-08-26 06:36:12 +02:00
#[ derive(Serialize, ToSchema, Debug, Clone) ]
pub struct FullViewData {
pub games : HashMap < i32 , ChellarisGame > ,
pub ethics : HashMap < i32 , Ethic > ,
pub species : HashMap < i32 , Species > ,
}
#[ derive(Serialize, ToSchema, Debug, Clone) ]
pub struct ChellarisGame {
pub id : i32 ,
pub name : String ,
pub groups : HashMap < i32 , ChellarisGameGroup > ,
pub empires : HashMap < i32 , ChellarisEmpire > ,
}
2023-08-30 04:16:43 +02:00
#[ derive(Serialize, ToSchema, Debug, Clone) ]
pub struct ChellarisGameLite {
pub id : i32 ,
pub name : String ,
}
2023-08-26 06:36:12 +02:00
#[ derive(Serialize, ToSchema, Debug, Clone) ]
pub struct ChellarisGameGroup {
pub id : i32 ,
pub name : String ,
}
#[ derive(Serialize, ToSchema, Debug, Clone) ]
pub struct ChellarisEmpire {
pub id : i32 ,
pub gestalt : bool ,
pub machine : bool ,
pub group : i32 ,
pub empire_portrait : i32 ,
pub empire_portrait_group : i32 ,
pub discord_user : Option < String > ,
pub ethics : HashMap < i32 , EmpireEthic > ,
}
#[ derive(Serialize, ToSchema, Debug, Clone) ]
pub struct Ethic {
pub id : i32 ,
pub displayName : String ,
pub machine : bool ,
}
#[ derive(Serialize, ToSchema, Debug, Clone) ]
pub struct EmpireEthic {
pub id : i32 ,
pub displayName : String ,
pub machine : bool ,
pub fanatic : bool ,
}
#[ derive(Serialize, ToSchema, Debug, Clone) ]
pub struct Species {
pub id : i32 ,
pub displayName : String ,
pub portraits : HashMap < i32 , Portrait > ,
}
#[ derive(Serialize, ToSchema, Debug, Clone) ]
pub struct Portrait {
pub id : i32 ,
pub hires : String ,
pub lores : Option < String > ,
2023-08-30 04:16:43 +02:00
}