xybrid-core 0.1.0

Core runtime for hybrid cloud-edge AI inference: model execution, pipeline orchestration, and routing primitives.
Documentation
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
//! Conditional routing for pipeline stages.
//!
//! This module provides expression evaluation for `when` clauses in stage configurations.
//! Expressions reference previous stage outputs using dot notation:
//!
//! ```yaml
//! when: "intent.output.intent == 'weather'"
//! when: "asr.output.confidence > 0.8"
//! when: "classifier.output.label in ['positive', 'neutral']"
//! ```
//!
//! ## Supported Expressions
//!
//! - **Comparison**: `==`, `!=`, `>`, `<`, `>=`, `<=`
//! - **Logical**: `and`, `or`, `not`
//! - **Membership**: `in` (for arrays)
//! - **Existence**: `exists()`, `is_empty()`
//! - **String matching**: `contains()`, `starts_with()`, `ends_with()`

use serde_json::Value;
use std::collections::HashMap;

/// Stage output context for condition evaluation.
#[derive(Debug, Clone, Default)]
pub struct StageOutputContext {
    /// Outputs from completed stages, keyed by stage ID.
    outputs: HashMap<String, Value>,
}

impl StageOutputContext {
    /// Create a new empty context.
    pub fn new() -> Self {
        Self {
            outputs: HashMap::new(),
        }
    }

    /// Add a stage output to the context.
    pub fn add_output(&mut self, stage_id: &str, output: Value) {
        self.outputs.insert(stage_id.to_string(), output);
    }

    /// Get a stage output by ID.
    pub fn get_output(&self, stage_id: &str) -> Option<&Value> {
        self.outputs.get(stage_id)
    }

    /// Resolve a path like "intent.output.intent" to a value.
    pub fn resolve_path(&self, path: &str) -> Option<&Value> {
        let parts: Vec<&str> = path.split('.').collect();
        if parts.is_empty() {
            return None;
        }

        // First part is the stage ID
        let stage_id = parts[0];
        let mut current = self.outputs.get(stage_id)?;

        // Navigate through the rest of the path
        for part in &parts[1..] {
            current = match current {
                Value::Object(map) => map.get(*part)?,
                Value::Array(arr) => {
                    // Support numeric indexing for arrays
                    let index: usize = part.parse().ok()?;
                    arr.get(index)?
                }
                _ => return None,
            };
        }

        Some(current)
    }

    /// Check if a stage output exists.
    pub fn has_output(&self, stage_id: &str) -> bool {
        self.outputs.contains_key(stage_id)
    }
}

/// Result of condition evaluation.
#[derive(Debug, Clone)]
pub enum ConditionResult {
    /// Condition evaluated to true - stage should execute.
    True,
    /// Condition evaluated to false - stage should be skipped.
    False,
    /// Condition could not be evaluated (missing data, parse error).
    Error(String),
}

impl ConditionResult {
    /// Check if the condition is satisfied.
    pub fn is_satisfied(&self) -> bool {
        matches!(self, ConditionResult::True)
    }

    /// Check if there was an error.
    pub fn is_error(&self) -> bool {
        matches!(self, ConditionResult::Error(_))
    }
}

/// Condition evaluator for `when` clauses.
pub struct ConditionEvaluator;

impl ConditionEvaluator {
    /// Evaluate a condition expression against stage outputs.
    pub fn evaluate(expr: &str, context: &StageOutputContext) -> ConditionResult {
        let expr = expr.trim();

        // Empty expression is always true
        if expr.is_empty() {
            return ConditionResult::True;
        }

        // Handle logical operators (lowest precedence)
        if let Some(result) = Self::try_logical_expr(expr, context) {
            return result;
        }

        // Handle comparison operators
        if let Some(result) = Self::try_comparison_expr(expr, context) {
            return result;
        }

        // Handle function calls
        if let Some(result) = Self::try_function_expr(expr, context) {
            return result;
        }

        // Handle 'in' operator
        if let Some(result) = Self::try_in_expr(expr, context) {
            return result;
        }

        // Handle boolean path (e.g., "stage.output.is_valid")
        if let Some(result) = Self::try_boolean_path(expr, context) {
            return result;
        }

        ConditionResult::Error(format!("Unable to parse expression: {}", expr))
    }

    /// Try to evaluate logical expressions (and, or, not).
    fn try_logical_expr(expr: &str, context: &StageOutputContext) -> Option<ConditionResult> {
        // Handle 'not' prefix
        if let Some(inner) = expr.strip_prefix("not ") {
            let result = Self::evaluate(inner.trim(), context);
            return Some(match result {
                ConditionResult::True => ConditionResult::False,
                ConditionResult::False => ConditionResult::True,
                ConditionResult::Error(e) => ConditionResult::Error(e),
            });
        }

        // Handle 'and' (with parentheses awareness)
        if let Some((left, right)) = Self::split_binary_op(expr, " and ") {
            let left_result = Self::evaluate(left, context);
            let right_result = Self::evaluate(right, context);
            return Some(match (&left_result, &right_result) {
                (ConditionResult::True, ConditionResult::True) => ConditionResult::True,
                (ConditionResult::Error(e), _) | (_, ConditionResult::Error(e)) => {
                    ConditionResult::Error(e.clone())
                }
                _ => ConditionResult::False,
            });
        }

        // Handle 'or' (with parentheses awareness)
        if let Some((left, right)) = Self::split_binary_op(expr, " or ") {
            let left_result = Self::evaluate(left, context);
            let right_result = Self::evaluate(right, context);
            return Some(match (&left_result, &right_result) {
                (ConditionResult::True, _) | (_, ConditionResult::True) => ConditionResult::True,
                (ConditionResult::Error(e), _) | (_, ConditionResult::Error(e)) => {
                    ConditionResult::Error(e.clone())
                }
                _ => ConditionResult::False,
            });
        }

        None
    }

    /// Try to evaluate comparison expressions.
    fn try_comparison_expr(expr: &str, context: &StageOutputContext) -> Option<ConditionResult> {
        // Order matters: check multi-char operators first
        let operators = ["==", "!=", ">=", "<=", ">", "<"];

        for op in operators {
            if let Some((left, right)) = Self::split_binary_op(expr, op) {
                let left_val = Self::resolve_value(left.trim(), context);
                let right_val = Self::resolve_value(right.trim(), context);

                let (left_val, right_val) = match (left_val, right_val) {
                    (Some(l), Some(r)) => (l, r),
                    _ => {
                        return Some(ConditionResult::Error(format!(
                            "Cannot resolve values in: {}",
                            expr
                        )));
                    }
                };

                let result = match op {
                    "==" => Self::values_equal(&left_val, &right_val),
                    "!=" => !Self::values_equal(&left_val, &right_val),
                    ">" => {
                        Self::compare_values(&left_val, &right_val)
                            == Some(std::cmp::Ordering::Greater)
                    }
                    "<" => {
                        Self::compare_values(&left_val, &right_val)
                            == Some(std::cmp::Ordering::Less)
                    }
                    ">=" => matches!(
                        Self::compare_values(&left_val, &right_val),
                        Some(std::cmp::Ordering::Greater | std::cmp::Ordering::Equal)
                    ),
                    "<=" => matches!(
                        Self::compare_values(&left_val, &right_val),
                        Some(std::cmp::Ordering::Less | std::cmp::Ordering::Equal)
                    ),
                    _ => false,
                };

                return Some(if result {
                    ConditionResult::True
                } else {
                    ConditionResult::False
                });
            }
        }

        None
    }

    /// Try to evaluate 'in' expressions.
    fn try_in_expr(expr: &str, context: &StageOutputContext) -> Option<ConditionResult> {
        if let Some((left, right)) = Self::split_binary_op(expr, " in ") {
            let left_val = Self::resolve_value(left.trim(), context)?;
            let right_val = Self::resolve_value(right.trim(), context)?;

            let result = match right_val {
                Value::Array(arr) => arr.iter().any(|v| Self::values_equal(&left_val, v)),
                Value::String(s) => {
                    if let Value::String(needle) = &left_val {
                        s.contains(needle.as_str())
                    } else {
                        false
                    }
                }
                _ => false,
            };

            return Some(if result {
                ConditionResult::True
            } else {
                ConditionResult::False
            });
        }

        None
    }

    /// Try to evaluate function expressions.
    fn try_function_expr(expr: &str, context: &StageOutputContext) -> Option<ConditionResult> {
        // exists(path)
        if let Some(inner) = Self::extract_function_arg(expr, "exists") {
            let exists = context.resolve_path(inner).is_some();
            return Some(if exists {
                ConditionResult::True
            } else {
                ConditionResult::False
            });
        }

        // is_empty(path)
        if let Some(inner) = Self::extract_function_arg(expr, "is_empty") {
            let value = context.resolve_path(inner);
            let is_empty = match value {
                None => true,
                Some(Value::Null) => true,
                Some(Value::String(s)) => s.is_empty(),
                Some(Value::Array(a)) => a.is_empty(),
                Some(Value::Object(o)) => o.is_empty(),
                _ => false,
            };
            return Some(if is_empty {
                ConditionResult::True
            } else {
                ConditionResult::False
            });
        }

        // contains(path, value)
        if let Some((path, needle)) = Self::extract_two_args(expr, "contains") {
            let value = context.resolve_path(path)?;
            let needle_val = Self::parse_literal(needle)?;

            let contains = match value {
                Value::String(s) => {
                    if let Value::String(n) = &needle_val {
                        s.contains(n.as_str())
                    } else {
                        false
                    }
                }
                Value::Array(arr) => arr.iter().any(|v| Self::values_equal(v, &needle_val)),
                _ => false,
            };

            return Some(if contains {
                ConditionResult::True
            } else {
                ConditionResult::False
            });
        }

        // starts_with(path, prefix)
        if let Some((path, prefix)) = Self::extract_two_args(expr, "starts_with") {
            let value = context.resolve_path(path)?;
            let prefix_val = Self::parse_literal(prefix)?;

            let starts = match (value, &prefix_val) {
                (Value::String(s), Value::String(p)) => s.starts_with(p.as_str()),
                _ => false,
            };

            return Some(if starts {
                ConditionResult::True
            } else {
                ConditionResult::False
            });
        }

        // ends_with(path, suffix)
        if let Some((path, suffix)) = Self::extract_two_args(expr, "ends_with") {
            let value = context.resolve_path(path)?;
            let suffix_val = Self::parse_literal(suffix)?;

            let ends = match (value, &suffix_val) {
                (Value::String(s), Value::String(p)) => s.ends_with(p.as_str()),
                _ => false,
            };

            return Some(if ends {
                ConditionResult::True
            } else {
                ConditionResult::False
            });
        }

        None
    }

    /// Try to evaluate a path as a boolean value.
    fn try_boolean_path(expr: &str, context: &StageOutputContext) -> Option<ConditionResult> {
        let value = context.resolve_path(expr)?;
        let is_truthy = match value {
            Value::Bool(b) => *b,
            Value::Null => false,
            Value::Number(n) => n.as_f64().map(|f| f != 0.0).unwrap_or(false),
            Value::String(s) => !s.is_empty(),
            Value::Array(a) => !a.is_empty(),
            Value::Object(o) => !o.is_empty(),
        };

        Some(if is_truthy {
            ConditionResult::True
        } else {
            ConditionResult::False
        })
    }

    /// Split expression on a binary operator, respecting parentheses.
    fn split_binary_op<'a>(expr: &'a str, op: &str) -> Option<(&'a str, &'a str)> {
        let mut depth = 0;
        let mut bracket_depth = 0;

        for (i, c) in expr.char_indices() {
            match c {
                '(' => depth += 1,
                ')' => depth -= 1,
                '[' => bracket_depth += 1,
                ']' => bracket_depth -= 1,
                _ => {}
            }

            if depth == 0 && bracket_depth == 0 && expr[i..].starts_with(op) {
                return Some((&expr[..i], &expr[i + op.len()..]));
            }
        }

        None
    }

    /// Resolve a value from either a path or a literal.
    fn resolve_value(expr: &str, context: &StageOutputContext) -> Option<Value> {
        let expr = expr.trim();

        // Try as literal first
        if let Some(val) = Self::parse_literal(expr) {
            return Some(val);
        }

        // Try as path
        context.resolve_path(expr).cloned()
    }

    /// Parse a literal value (string, number, boolean, array).
    fn parse_literal(expr: &str) -> Option<Value> {
        let expr = expr.trim();

        // String literal
        if (expr.starts_with('"') && expr.ends_with('"'))
            || (expr.starts_with('\'') && expr.ends_with('\''))
        {
            return Some(Value::String(expr[1..expr.len() - 1].to_string()));
        }

        // Boolean literals
        if expr == "true" {
            return Some(Value::Bool(true));
        }
        if expr == "false" {
            return Some(Value::Bool(false));
        }

        // Null
        if expr == "null" || expr == "nil" {
            return Some(Value::Null);
        }

        // Number
        if let Ok(n) = expr.parse::<i64>() {
            return Some(Value::Number(n.into()));
        }
        if let Ok(n) = expr.parse::<f64>() {
            return serde_json::Number::from_f64(n).map(Value::Number);
        }

        // Array literal
        if expr.starts_with('[') && expr.ends_with(']') {
            let inner = &expr[1..expr.len() - 1];
            let items: Vec<Value> = inner
                .split(',')
                .filter_map(|s| Self::parse_literal(s.trim()))
                .collect();
            return Some(Value::Array(items));
        }

        None
    }

    /// Check if two values are equal.
    fn values_equal(a: &Value, b: &Value) -> bool {
        match (a, b) {
            (Value::String(a), Value::String(b)) => a == b,
            (Value::Number(a), Value::Number(b)) => a
                .as_f64()
                .zip(b.as_f64())
                .map(|(a, b)| (a - b).abs() < f64::EPSILON)
                .unwrap_or(false),
            (Value::Bool(a), Value::Bool(b)) => a == b,
            (Value::Null, Value::Null) => true,
            (Value::Array(a), Value::Array(b)) => {
                a.len() == b.len()
                    && a.iter()
                        .zip(b.iter())
                        .all(|(x, y)| Self::values_equal(x, y))
            }
            _ => false,
        }
    }

    /// Compare two values for ordering.
    fn compare_values(a: &Value, b: &Value) -> Option<std::cmp::Ordering> {
        match (a, b) {
            (Value::Number(a), Value::Number(b)) => {
                let a = a.as_f64()?;
                let b = b.as_f64()?;
                a.partial_cmp(&b)
            }
            (Value::String(a), Value::String(b)) => Some(a.cmp(b)),
            _ => None,
        }
    }

    /// Extract the argument from a function call like "exists(path)".
    fn extract_function_arg<'a>(expr: &'a str, func_name: &str) -> Option<&'a str> {
        let prefix = format!("{}(", func_name);
        if expr.starts_with(&prefix) && expr.ends_with(')') {
            Some(&expr[prefix.len()..expr.len() - 1])
        } else {
            None
        }
    }

    /// Extract two arguments from a function call like "contains(path, value)".
    fn extract_two_args<'a>(expr: &'a str, func_name: &str) -> Option<(&'a str, &'a str)> {
        let prefix = format!("{}(", func_name);
        if expr.starts_with(&prefix) && expr.ends_with(')') {
            let inner = &expr[prefix.len()..expr.len() - 1];
            let comma_pos = inner.find(',')?;
            Some((inner[..comma_pos].trim(), inner[comma_pos + 1..].trim()))
        } else {
            None
        }
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use serde_json::json;

    fn test_context() -> StageOutputContext {
        let mut ctx = StageOutputContext::new();
        ctx.add_output(
            "intent",
            json!({
                "output": {
                    "intent": "weather",
                    "confidence": 0.95,
                    "entities": ["location", "time"]
                }
            }),
        );
        ctx.add_output(
            "asr",
            json!({
                "output": {
                    "text": "What's the weather like?",
                    "confidence": 0.88
                }
            }),
        );
        ctx.add_output(
            "classifier",
            json!({
                "output": {
                    "label": "positive",
                    "scores": [0.8, 0.15, 0.05]
                }
            }),
        );
        ctx
    }

    #[test]
    fn test_equality_comparison() {
        let ctx = test_context();

        let result = ConditionEvaluator::evaluate("intent.output.intent == 'weather'", &ctx);
        assert!(result.is_satisfied());

        let result = ConditionEvaluator::evaluate("intent.output.intent == 'music'", &ctx);
        assert!(!result.is_satisfied());

        let result = ConditionEvaluator::evaluate("intent.output.intent != 'music'", &ctx);
        assert!(result.is_satisfied());
    }

    #[test]
    fn test_numeric_comparison() {
        let ctx = test_context();

        let result = ConditionEvaluator::evaluate("intent.output.confidence > 0.9", &ctx);
        assert!(result.is_satisfied());

        let result = ConditionEvaluator::evaluate("intent.output.confidence < 0.9", &ctx);
        assert!(!result.is_satisfied());

        let result = ConditionEvaluator::evaluate("asr.output.confidence >= 0.88", &ctx);
        assert!(result.is_satisfied());

        let result = ConditionEvaluator::evaluate("asr.output.confidence <= 0.88", &ctx);
        assert!(result.is_satisfied());
    }

    #[test]
    fn test_logical_operators() {
        let ctx = test_context();

        // and
        let result = ConditionEvaluator::evaluate(
            "intent.output.intent == 'weather' and intent.output.confidence > 0.9",
            &ctx,
        );
        assert!(result.is_satisfied());

        let result = ConditionEvaluator::evaluate(
            "intent.output.intent == 'weather' and intent.output.confidence > 0.99",
            &ctx,
        );
        assert!(!result.is_satisfied());

        // or
        let result = ConditionEvaluator::evaluate(
            "intent.output.intent == 'music' or intent.output.intent == 'weather'",
            &ctx,
        );
        assert!(result.is_satisfied());

        // not
        let result = ConditionEvaluator::evaluate("not intent.output.intent == 'music'", &ctx);
        assert!(result.is_satisfied());
    }

    #[test]
    fn test_in_operator() {
        let ctx = test_context();

        let result = ConditionEvaluator::evaluate(
            "classifier.output.label in ['positive', 'neutral']",
            &ctx,
        );
        assert!(result.is_satisfied());

        let result = ConditionEvaluator::evaluate(
            "classifier.output.label in ['negative', 'neutral']",
            &ctx,
        );
        assert!(!result.is_satisfied());

        // String contains
        let result = ConditionEvaluator::evaluate("'location' in intent.output.entities", &ctx);
        assert!(result.is_satisfied());
    }

    #[test]
    fn test_function_exists() {
        let ctx = test_context();

        let result = ConditionEvaluator::evaluate("exists(intent.output.intent)", &ctx);
        assert!(result.is_satisfied());

        let result = ConditionEvaluator::evaluate("exists(intent.output.nonexistent)", &ctx);
        assert!(!result.is_satisfied());
    }

    #[test]
    fn test_function_is_empty() {
        let mut ctx = StageOutputContext::new();
        ctx.add_output(
            "test",
            json!({
                "empty_string": "",
                "empty_array": [],
                "non_empty": "hello"
            }),
        );

        let result = ConditionEvaluator::evaluate("is_empty(test.empty_string)", &ctx);
        assert!(result.is_satisfied());

        let result = ConditionEvaluator::evaluate("is_empty(test.empty_array)", &ctx);
        assert!(result.is_satisfied());

        let result = ConditionEvaluator::evaluate("is_empty(test.non_empty)", &ctx);
        assert!(!result.is_satisfied());
    }

    #[test]
    fn test_function_contains() {
        let ctx = test_context();

        let result = ConditionEvaluator::evaluate("contains(asr.output.text, 'weather')", &ctx);
        assert!(result.is_satisfied());

        let result = ConditionEvaluator::evaluate("contains(asr.output.text, 'music')", &ctx);
        assert!(!result.is_satisfied());
    }

    #[test]
    fn test_function_starts_ends_with() {
        let ctx = test_context();

        let result = ConditionEvaluator::evaluate("starts_with(asr.output.text, 'What')", &ctx);
        assert!(result.is_satisfied());

        let result = ConditionEvaluator::evaluate("ends_with(asr.output.text, '?')", &ctx);
        assert!(result.is_satisfied());
    }

    #[test]
    fn test_boolean_path() {
        let mut ctx = StageOutputContext::new();
        ctx.add_output(
            "validation",
            json!({
                "is_valid": true,
                "is_spam": false
            }),
        );

        let result = ConditionEvaluator::evaluate("validation.is_valid", &ctx);
        assert!(result.is_satisfied());

        let result = ConditionEvaluator::evaluate("validation.is_spam", &ctx);
        assert!(!result.is_satisfied());
    }

    #[test]
    fn test_empty_expression() {
        let ctx = test_context();
        let result = ConditionEvaluator::evaluate("", &ctx);
        assert!(result.is_satisfied());
    }

    #[test]
    fn test_missing_path() {
        let ctx = test_context();
        let result = ConditionEvaluator::evaluate("nonexistent.path == 'value'", &ctx);
        assert!(result.is_error());
    }

    #[test]
    fn test_path_resolution() {
        let ctx = test_context();

        // Nested path
        assert_eq!(
            ctx.resolve_path("intent.output.intent"),
            Some(&Value::String("weather".to_string()))
        );

        // Array access
        assert_eq!(
            ctx.resolve_path("intent.output.entities.0"),
            Some(&Value::String("location".to_string()))
        );
    }
}