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
use crate::json_types;
use bigquery_functions_types_macros::enum_category;

enum_category!();

pub struct Function {
    pub name: String,
    pub arguments: Vec<Argument>,
    pub category: Category,
    pub return_type: String,
    pub description: String,
}

impl Function {
    pub fn new(
        name: String,
        arguments: Vec<Argument>,
        category: Category,
        return_type: String,
        description: String,
    ) -> Self {
        Function {
            name,
            arguments,
            category,
            return_type,
            description,
        }
    }
}

pub struct Argument {
    pub name: Option<String>,
    pub supported_argument_type: String,
}

impl Argument {
    pub fn new(name: Option<String>, supported_argument_type: String) -> Self {
        Argument {
            name,
            supported_argument_type,
        }
    }

    pub fn from_json_function_argument(json_function_argument: &json_types::Argument) -> Self {
        Self {
            name: json_function_argument.name.clone(),
            supported_argument_type: json_function_argument.supported_argument_type.clone(),
        }
    }
}