/*
* Chess
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0
*
* Generated by: https://openapi-generator.tech
*/
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct PlayerResult {
#[serde(rename = "username")]
pub username: String,
/// The player's rating at the start of the game
#[serde(rename = "rating")]
pub rating: i32,
/// Player result: * `win` - Win * `checkmated` - Checkmated * `agreed` - Draw agreed * `repetition` - Draw by repetition * `timeout` - Timeout * `resigned` - Resigned * `stalemate` - Stalemate * `lose` - Lose * `insufficient` - Insufficient material * `50` - Draw by 50-move rule * `abandoned` - abandoned * `kingofthehill` - Opponent king reached the hill * `threecheck` - Checked for the 3rd time * `timevsinsufficient` - Draw by timeout vs insufficient material * `bughousepartnerlose` - Bughouse partner lost
#[serde(rename = "result")]
pub result: Result,
/// URL of this player's profile
#[serde(rename = "@id")]
pub id: String,
}
impl PlayerResult {
pub fn new(username: String, rating: i32, result: Result, id: String) -> PlayerResult {
PlayerResult {
username,
rating,
result,
id,
}
}
}
/// Player result: * `win` - Win * `checkmated` - Checkmated * `agreed` - Draw agreed * `repetition` - Draw by repetition * `timeout` - Timeout * `resigned` - Resigned * `stalemate` - Stalemate * `lose` - Lose * `insufficient` - Insufficient material * `50` - Draw by 50-move rule * `abandoned` - abandoned * `kingofthehill` - Opponent king reached the hill * `threecheck` - Checked for the 3rd time * `timevsinsufficient` - Draw by timeout vs insufficient material * `bughousepartnerlose` - Bughouse partner lost
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Result {
#[serde(rename = "win")]
Win,
#[serde(rename = "checkmated")]
Checkmated,
#[serde(rename = "agreed")]
Agreed,
#[serde(rename = "repetition")]
Repetition,
#[serde(rename = "timeout")]
Timeout,
#[serde(rename = "resigned")]
Resigned,
#[serde(rename = "stalemate")]
Stalemate,
#[serde(rename = "lose")]
Lose,
#[serde(rename = "insufficient")]
Insufficient,
#[serde(rename = "50move")]
_50move,
#[serde(rename = "abandoned")]
Abandoned,
#[serde(rename = "kingofthehill")]
Kingofthehill,
#[serde(rename = "threecheck")]
Threecheck,
#[serde(rename = "timevsinsufficient")]
Timevsinsufficient,
#[serde(rename = "bughousepartnerlose")]
Bughousepartnerlose,
}
impl std::fmt::Display for Result {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Result::Win => write!(f, "win"),
Result::Checkmated => write!(f, "checkmated"),
Result::Agreed => write!(f, "agreed"),
Result::Repetition => write!(f, "repetition"),
Result::Timeout => write!(f, "timeout"),
Result::Resigned => write!(f, "resigned"),
Result::Stalemate => write!(f, "stalemate"),
Result::Lose => write!(f, "lose"),
Result::Insufficient => write!(f, "insufficient"),
Result::_50move => write!(f, "50move"),
Result::Abandoned => write!(f, "abandoned"),
Result::Kingofthehill => write!(f, "kingofthehill"),
Result::Threecheck => write!(f, "threecheck"),
Result::Timevsinsufficient => write!(f, "timevsinsufficient"),
Result::Bughousepartnerlose => write!(f, "bughousepartnerlose"),
}
}
}