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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
use crate::impl_options_trait;
use crate::options::CommonOperationOptions;

#[derive(Clone, Default)]
pub struct CreateProjectionOptions {
    pub(crate) track_emitted_streams: bool,
    pub(crate) emit: bool,
    pub(crate) common_operation_options: CommonOperationOptions,
}

impl_options_trait!(CreateProjectionOptions);

impl CreateProjectionOptions {
    pub fn new() -> Self {
        Default::default()
    }

    pub fn track_emitted_streams(self, track_emitted_streams: bool) -> Self {
        Self {
            track_emitted_streams,
            ..self
        }
    }

    pub fn emit(self, emit: bool) -> Self {
        Self { emit, ..self }
    }
}

#[derive(Clone, Default)]
pub struct UpdateProjectionOptions {
    pub(crate) emit: Option<bool>,
    pub(crate) common_operation_options: CommonOperationOptions,
}

impl_options_trait!(UpdateProjectionOptions);

impl UpdateProjectionOptions {
    pub fn new() -> Self {
        Default::default()
    }

    pub fn emit(self, emit: bool) -> Self {
        Self {
            emit: Some(emit),
            ..self
        }
    }
}

#[derive(Clone, Default)]
pub struct DeleteProjectionOptions {
    pub(crate) delete_emitted_streams: bool,
    pub(crate) delete_state_stream: bool,
    pub(crate) delete_checkpoint_stream: bool,
    pub(crate) common_operation_options: CommonOperationOptions,
}

impl_options_trait!(DeleteProjectionOptions);

impl DeleteProjectionOptions {
    pub fn new() -> Self {
        Default::default()
    }

    pub fn delete_emitted_streams(self, delete_emitted_streams: bool) -> Self {
        Self {
            delete_emitted_streams,
            ..self
        }
    }

    pub fn delete_state_stream(self, delete_state_stream: bool) -> Self {
        Self {
            delete_state_stream,
            ..self
        }
    }

    pub fn delete_checkpoint_stream(self, delete_checkpoint_stream: bool) -> Self {
        Self {
            delete_checkpoint_stream,
            ..self
        }
    }
}

#[derive(Clone, Default)]
pub struct GetStateProjectionOptions {
    pub(crate) partition: String,
    pub(crate) common_operation_options: CommonOperationOptions,
}

impl_options_trait!(GetStateProjectionOptions);

impl GetStateProjectionOptions {
    pub fn new() -> Self {
        Default::default()
    }

    pub fn partition(self, value: impl AsRef<str>) -> Self {
        Self {
            partition: value.as_ref().to_string(),
            ..self
        }
    }
}

#[derive(Clone, Default)]
pub struct GetResultProjectionOptions {
    pub(crate) partition: String,
    pub(crate) common_operation_options: CommonOperationOptions,
}

impl_options_trait!(GetResultProjectionOptions);

impl GetResultProjectionOptions {
    pub fn new() -> Self {
        Default::default()
    }

    pub fn partition(self, value: impl AsRef<str>) -> Self {
        Self {
            partition: value.as_ref().to_string(),
            ..self
        }
    }
}

#[derive(Clone, Default)]
pub struct GenericProjectionOptions {
    pub(crate) common_operation_options: CommonOperationOptions,
}

impl_options_trait!(GenericProjectionOptions);