1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use crate::configs::SimpleId;
use serde::Deserialize;

#[derive(Clone, Debug, Deserialize)]
pub enum Category {
    Id(SimpleId),
    Ignored,
}

impl From<ProtoCategory> for Category {
    fn from(proto_category: ProtoCategory) -> Category {
        match proto_category {
            ProtoCategory::Id(id) => Category::Id(id),
            ProtoCategory::Ignored => Category::Ignored,
        }
    }
}

#[derive(Clone, Debug, Deserialize)]
pub enum ProtoCategory {
    Id(SimpleId),
    Ignored,
}

impl From<RawCategory> for ProtoCategory {
    fn from(raw_category: RawCategory) -> ProtoCategory {
        match raw_category {
            RawCategory::Id(id) => ProtoCategory::Id(id),
            RawCategory::Ignored => ProtoCategory::Ignored,
        }
    }
}

#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum RawCategory {
    Id(SimpleId),
    Ignored,
}