vlr_scraper/model/
player.rs1use serde::Serialize;
2
3use super::common::{EventPlacement, Social};
4use super::match_item::{MatchItem, MatchItemList, MatchItemTeam};
5
6pub type PlayerMatchList = MatchItemList;
8
9pub type PlayerMatchListItem = MatchItem;
11
12pub type PlayerMatchListTeam = MatchItemTeam;
14
15#[derive(Debug, Clone, Serialize)]
17pub struct Player {
18 pub info: PlayerInfo,
19 pub current_teams: Vec<PlayerTeam>,
20 pub past_teams: Vec<PlayerTeam>,
21 pub agent_stats: Vec<PlayerAgentStats>,
22 pub news: Vec<PlayerNewsItem>,
23 pub event_placements: Vec<EventPlacement>,
24 pub total_winnings: Option<String>,
25}
26
27#[derive(Debug, Clone, Serialize)]
29pub struct PlayerInfo {
30 pub id: u32,
31 pub name: String,
32 pub real_name: Option<String>,
33 pub avatar_url: Option<String>,
34 pub country: Option<String>,
35 pub country_code: Option<String>,
36 pub socials: Vec<Social>,
37}
38
39#[derive(Debug, Clone, Serialize)]
41pub struct PlayerTeam {
42 pub id: u32,
43 pub slug: String,
44 pub href: String,
45 pub name: String,
46 pub logo_url: String,
47 pub info: Option<String>,
48}
49
50#[derive(Debug, Clone, Serialize)]
52pub struct PlayerAgentStats {
53 pub agent: String,
54 pub usage_count: u32,
55 pub usage_pct: f32,
56 pub rounds: u32,
57 pub rating: f32,
58 pub acs: f32,
59 pub kd: f32,
60 pub adr: f32,
61 pub kast: f32,
62 pub kpr: f32,
63 pub apr: f32,
64 pub fkpr: f32,
65 pub fdpr: f32,
66 pub kills: u32,
67 pub deaths: u32,
68 pub assists: u32,
69 pub first_kills: u32,
70 pub first_deaths: u32,
71}
72
73#[derive(
75 Default,
76 Debug,
77 Clone,
78 Copy,
79 Hash,
80 Eq,
81 PartialEq,
82 Serialize,
83 strum_macros::Display,
84 strum_macros::EnumString,
85)]
86pub enum AgentStatsTimespan {
87 #[strum(serialize = "30d")]
88 Days30,
89 #[strum(serialize = "60d")]
90 Days60,
91 #[default]
92 #[strum(serialize = "90d")]
93 Days90,
94 #[strum(serialize = "all")]
95 All,
96}
97
98#[derive(Debug, Clone, Serialize)]
100pub struct PlayerNewsItem {
101 pub href: String,
102 pub date: String,
103 pub title: String,
104}