use derive_more::Display;
use serde::Deserialize;
#[derive(Copy, Clone, Default, PartialEq, Eq)]
pub enum SituationCodeFilter {
All,
#[default]
Any,
}
#[derive(Debug, Deserialize, PartialEq, Eq, Copy, Clone, Display)]
pub enum SituationCodeCategory {
#[serde(rename = "Game")]
#[display("Game")]
Game,
#[serde(rename = "Month")]
#[display("Month")]
Month,
#[serde(rename = "Timeframe")]
#[display("Timeframe")]
Timeframe,
#[serde(rename = "Day")]
#[display("Day")]
DayOfWeek,
#[serde(rename = "Opponent")]
#[display("Opponent")]
Opponent,
#[serde(rename = "Venue")]
#[display("Venue")]
Venue,
#[serde(rename = "At-Bat")]
#[display("At-Bat")]
AtBat,
#[serde(rename = "Score")]
#[display("Score")]
GameScore,
#[serde(rename = "Inning")]
#[display("Inning")]
Inning,
#[serde(rename = "Result")]
#[display("Result")]
GameResult,
#[serde(rename = "Order")]
#[display("Order")]
BattingOrder,
#[serde(rename = "Runners")]
#[display("Runners")]
Runners,
#[serde(rename = "Position")]
#[display("Position")]
Position,
#[serde(rename = "Pitching")]
#[display("Pitching")]
Pitching,
#[serde(rename = "Pitch Count")]
#[display("Pitch Count")]
PitchCount,
#[serde(rename = "Outs")]
#[display("Outs")]
Outs,
#[serde(rename = "Count")]
#[display("Count")]
AtBatCount,
#[serde(rename = "Pitch Type")]
#[display("Pitch Type")]
PitchType,
}
id!(#[doc = "A [`String`] representing a situation, such as c00 for a 0-0 count"] SituationCodeId { code: String });
#[allow(clippy::struct_excessive_bools, reason = "false positive")]
#[derive(Debug, Deserialize, Clone)]
pub struct SituationCode {
#[serde(rename = "navigationMenu", default)]
pub category: Option<SituationCodeCategory>,
pub description: String,
#[serde(rename = "team")]
pub is_team_active: bool,
#[serde(rename = "batting")]
pub is_batting_active: bool,
#[serde(rename = "fielding")]
pub is_fielding_active: bool,
#[serde(rename = "pitching")]
pub is_pitching_active: bool,
#[serde(flatten)]
pub id: SituationCodeId,
}
id_only_eq_impl!(SituationCode, id);
meta_kind_impl!("situationCodes" => SituationCode);
tiered_request_entry_cache_impl!(SituationCode.id: SituationCodeId);
test_impl!(SituationCode);