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
40
41
42
43
44
45
46
47
use super::*;

#[derive(Debug, PartialEq, Eq, ProvidesStaticType, Allocative, Clone, Deserialize, Serialize)]
pub enum Operation {
    Normal,
    Concat,
    Combine,
    Map(String),
}

impl Operation {
    pub fn is_map(&self) -> bool {
        matches!(self, Self::Map(_))
    }

    pub fn is_combine(&self) -> bool {
        matches!(self, Self::Combine)
    }
}

impl Default for Operation {
    fn default() -> Operation {
        Self::Normal
    }
}

#[derive(
    Debug, Default, PartialEq, Eq, Allocative, ProvidesStaticType, Clone, Deserialize, Serialize,
)]
pub struct Depend {
    pub task_name: String,
    pub cur_field: String,
    pub prev_field: String,
}

#[derive(
    Debug, Default, PartialEq, Eq, ProvidesStaticType, Allocative, Clone, Deserialize, Serialize,
)]
pub struct Task {
    pub kind: String,
    pub action_name: String,
    pub input_arguments: Vec<Input>,
    pub attributes: HashMap<String, String>,
    #[serde(default)]
    pub operation: Operation,
    pub depend_on: Vec<Depend>,
}