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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use serde::{Deserialize, Serialize};
use wakflo_common::{
    plugin::{PluginCompiler, PluginLanguage},
    TaskPlatform, TaskType,
};

/// # [TaskMetadata]
///
/// Plugin generated metadata
#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug)]
pub struct PluginMetadata {
    /// Plugin written language
    pub language: PluginLanguage,
    pub compiler: PluginCompiler,
}

/// # [TaskProperties]
///
/// Plugin generated metadata
#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug, Default)]
pub struct TaskProperties {
    pub input: serde_json::Value,
    pub output: serde_json::Value,
    pub authentication: Option<serde_json::Value>,
}

/// # Task
///
/// Task contract represent an ant schema that takes in
/// operators and actions to be performed on a dataset
#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug)]
pub struct Task {
    /// Unique identifier of a schema
    pub id: String,

    /// Name of the the schema
    pub name: String,

    /// Name of the the schema
    pub display_name: String,

    /// Name of the the schema
    pub description: String,

    /// Name of the the schema
    pub documentation: Option<String>,

    /// TaskType of the the schema
    pub task_type: TaskType,

    /// TaskType of the the schema
    pub platform: TaskPlatform,

    /// Human readable identity of a schema
    pub namespace: Option<String>,

    /// Human readable identity of a category
    pub category_id: Option<String>,

    pub properties: TaskProperties,

    pub version: String,

    pub icon: String,

    pub published: bool,

    pub approved: bool,

    /// Date the entity was created
    pub created_at: chrono::DateTime<chrono::FixedOffset>,

    /// Date the entity was updated
    pub updated_at: chrono::DateTime<chrono::FixedOffset>,

    pub metadata: Option<PluginMetadata>,
}