Skip to main content

megalodon/entities/
report.rs

1use core::fmt;
2
3use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6use super::Account;
7
8#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
9pub struct Report {
10    pub id: String,
11    pub action_taken: bool,
12    pub action_taken_at: Option<DateTime<Utc>>,
13    pub status_ids: Option<Vec<String>>,
14    pub rule_ids: Option<Vec<String>>,
15    // These parameters are optional in Pleroma.
16    pub category: Option<Category>,
17    pub comment: Option<String>,
18    pub forwarded: Option<bool>,
19    pub target_account: Option<Account>,
20}
21
22#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
23#[serde(rename_all = "lowercase")]
24pub enum Category {
25    Spam,
26    Violation,
27    Other,
28}
29
30impl fmt::Display for Category {
31    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32        match self {
33            Category::Spam => write!(f, "spam"),
34            Category::Violation => write!(f, "violation"),
35            Category::Other => write!(f, "other"),
36        }
37    }
38}