1use std::{collections::HashMap, net::SocketAddr};
2
3use serde_value::Value;
4
5use crate::model::{Category, Torrent};
6
7#[derive(Debug, Clone, serde::Deserialize, PartialEq)]
8pub struct SyncData {
9 pub rid: i64,
11 pub full_update: Option<bool>,
13 pub torrents: Option<HashMap<String, Torrent>>,
15 pub torrents_removed: Option<Vec<String>>,
17 pub categories: Option<HashMap<String, Category>>,
19 pub categories_removed: Option<Vec<String>>,
21 pub tags: Option<Vec<String>>,
23 pub tags_removed: Option<Vec<String>>,
25 pub trackers: Option<HashMap<String, Vec<String>>>,
28 pub trackers_removed: Option<Vec<String>>,
30 pub server_state: Option<HashMap<String, Value>>,
32}
33
34#[derive(Debug, Clone, serde::Deserialize, PartialEq)]
35pub struct PeerSyncData {
36 pub full_update: Option<bool>,
37 pub peers: Option<HashMap<SocketAddr, Peer>>,
38 pub peers_removed: Option<Vec<SocketAddr>>,
39 pub rid: i64,
40 pub show_flags: bool,
41}
42#[derive(Debug, Clone, serde::Deserialize, PartialEq)]
43pub struct Peer {
44 pub client: Option<String>,
45 pub connection: Option<String>,
46 pub country: Option<String>,
47 pub country_code: Option<String>,
48 pub dl_speed: Option<u64>,
49 pub downloaded: Option<u64>,
50 pub files: Option<String>,
51 pub flags: Option<String>,
52 pub flags_desc: Option<String>,
53 pub ip: Option<String>,
54 pub port: Option<u16>,
55 pub progress: Option<f64>,
56 pub relevance: Option<u64>,
57 pub up_speed: Option<u64>,
58 pub uploaded: Option<u64>,
59}