1use std::collections::BTreeMap;
2
3use serde::{Deserialize, Serialize};
4use serde_json::Value;
5
6use crate::types::Asset;
7
8#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
9pub struct Comment {
10 pub author: String,
11 pub permlink: String,
12 #[serde(default)]
13 pub parent_author: Option<String>,
14 #[serde(default)]
15 pub parent_permlink: Option<String>,
16 #[serde(default)]
17 pub body: Option<String>,
18 #[serde(flatten)]
19 pub extra: BTreeMap<String, Value>,
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
23pub struct Discussion {
24 #[serde(flatten)]
25 pub comment: Comment,
26 #[serde(default)]
27 pub active_votes: Vec<ActiveVote>,
28 #[serde(default)]
29 pub pending_payout_value: Option<Asset>,
30 #[serde(flatten)]
31 pub extra: BTreeMap<String, Value>,
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)]
35pub struct BeneficiaryRoute {
36 pub account: String,
37 pub weight: u16,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
41pub struct ActiveVote {
42 pub voter: String,
43 pub rshares: String,
44 pub percent: i16,
45 #[serde(default)]
46 pub reputation: Option<String>,
47 #[serde(flatten)]
48 pub extra: BTreeMap<String, Value>,
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
52#[serde(rename_all = "snake_case")]
53pub enum DiscussionQueryCategory {
54 Trending,
55 Created,
56 Active,
57 Cashout,
58 Payout,
59 Votes,
60 Children,
61 Hot,
62 Feed,
63 Blog,
64 Comments,
65 Promoted,
66 Replies,
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
70pub struct DiscussionQuery {
71 #[serde(default)]
72 pub tag: Option<String>,
73 #[serde(default)]
74 pub limit: Option<u32>,
75 #[serde(default)]
76 pub start_author: Option<String>,
77 #[serde(default)]
78 pub start_permlink: Option<String>,
79 #[serde(default)]
80 pub truncate_body: Option<u32>,
81 #[serde(flatten)]
82 pub extra: BTreeMap<String, Value>,
83}
84
85pub type DisqussionQuery = DiscussionQuery;