Skip to main content

news_flash/models/
plugin_info.rs

1use crate::models::{LoginGUI, PluginID, Url};
2
3#[derive(Debug)]
4pub struct PluginInfo {
5    pub id: PluginID,
6    pub name: String,
7    pub icon: Option<PluginIcon>,
8    pub icon_symbolic: Option<PluginIcon>,
9    pub website: Option<Url>,
10    pub service_type: ServiceType,
11    pub license_type: ServiceLicense,
12    pub service_price: ServicePrice,
13    pub login_gui: LoginGUI,
14}
15
16#[derive(Debug, Clone)]
17pub enum PluginIcon {
18    Vector(VectorIcon),
19    Pixel(PixelIcon),
20}
21
22impl PluginIcon {
23    pub fn into_data(self) -> Vec<u8> {
24        match self {
25            Self::Vector(icon) => icon.data,
26            Self::Pixel(icon) => icon.data,
27        }
28    }
29}
30
31#[derive(Debug, Clone)]
32pub struct VectorIcon {
33    pub data: Vec<u8>,
34    pub width: i32,
35    pub height: i32,
36}
37
38#[derive(Debug, Clone)]
39pub struct PixelIcon {
40    pub data: Vec<u8>,
41    pub width: i32,
42    pub height: i32,
43    pub has_alpha: bool,
44    pub bits_per_sample: i32,
45    pub row_stride: i32,
46}
47
48#[derive(Debug, Clone, PartialEq, Eq)]
49pub enum ServiceType {
50    Local,
51    Remote { self_hosted: bool },
52}
53
54#[derive(Debug, Clone)]
55pub enum ServiceLicense {
56    ApacheV2,
57    AGPLv3,
58    GPLv2,
59    GPLv3,
60    MIT,
61    LGPLv21,
62    GenericFree,
63    GenericProprietary,
64}
65
66#[derive(Debug, Clone)]
67pub enum ServicePrice {
68    Free,
69    Paid,
70    PaidPremimum,
71}