orvanta_api/models/evaluate_response.rs
1/*
2 * Orvanta API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 3.0.0
7 * Contact: contact@orvanta.cloud
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct EvaluateResponse {
16 #[serde(rename = "hit_policy")]
17 pub hit_policy: String,
18 /// The COLLECT aggregator that ran (DMN tBuiltinAggregator). Absent for every hit policy other than COLLECT, and for a plain un-aggregated COLLECT. When present, outputs holds a scalar per output column instead of the array a plain COLLECT returns.
19 #[serde(rename = "aggregation", skip_serializing_if = "Option::is_none")]
20 pub aggregation: Option<Aggregation>,
21 /// 1-based rule numbers, in the order the hit policy selected them
22 #[serde(rename = "matched_rules")]
23 pub matched_rules: Vec<i32>,
24 /// Output values keyed by output column name (COLLECT yields an array per key)
25 #[serde(rename = "outputs")]
26 pub outputs: std::collections::HashMap<String, serde_json::Value>,
27 /// Inputs that have no FEEL representation and were therefore absent from the context this decision was evaluated against, each as \"`name`: reason\". Omitted rather than fatal, so that the API and a running businessRuleTask evaluate the same decision identically. Absent when everything mapped.
28 #[serde(rename = "unmapped_inputs", skip_serializing_if = "Option::is_none")]
29 pub unmapped_inputs: Option<Vec<String>>,
30}
31
32impl EvaluateResponse {
33 pub fn new(hit_policy: String, matched_rules: Vec<i32>, outputs: std::collections::HashMap<String, serde_json::Value>) -> EvaluateResponse {
34 EvaluateResponse {
35 hit_policy,
36 aggregation: None,
37 matched_rules,
38 outputs,
39 unmapped_inputs: None,
40 }
41 }
42}
43/// The COLLECT aggregator that ran (DMN tBuiltinAggregator). Absent for every hit policy other than COLLECT, and for a plain un-aggregated COLLECT. When present, outputs holds a scalar per output column instead of the array a plain COLLECT returns.
44#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
45pub enum Aggregation {
46 #[serde(rename = "SUM")]
47 Sum,
48 #[serde(rename = "MIN")]
49 Min,
50 #[serde(rename = "MAX")]
51 Max,
52 #[serde(rename = "COUNT")]
53 Count,
54}
55
56impl Default for Aggregation {
57 fn default() -> Aggregation {
58 Self::Sum
59 }
60}
61