axioval_ir/contract/
selectors.rs

1#![allow(missing_docs)]
2use super::ParameterValue;
3use serde::{Deserialize, Serialize};
4#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5#[serde(tag = "kind", rename_all = "camelCase", deny_unknown_fields)]
6pub enum Selector {
7    All,
8    EntityType {
9        #[serde(rename = "objectType")]
10        object_type: String,
11        #[serde(rename = "includeSubtypes", default = "yes")]
12        include_subtypes: bool,
13    },
14    Property {
15        #[serde(rename = "propertySet")]
16        property_set: Option<String>,
17        property: String,
18        operator: ComparisonOperator,
19        value: Option<ParameterValue>,
20    },
21    Classification {
22        system: String,
23        code: String,
24        #[serde(rename = "includeDescendants", default)]
25        include_descendants: bool,
26    },
27    AllOf {
28        operands: Vec<Selector>,
29    },
30    AnyOf {
31        operands: Vec<Selector>,
32    },
33    Not {
34        operand: Box<Selector>,
35    },
36}
37impl Default for Selector {
38    fn default() -> Self {
39        Self::All
40    }
41}
42#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
43#[serde(rename_all = "camelCase")]
44pub enum ComparisonOperator {
45    Equals,
46    NotEquals,
47    LessThan,
48    LessThanOrEquals,
49    GreaterThan,
50    GreaterThanOrEquals,
51    Matches,
52    Exists,
53}
54const fn yes() -> bool {
55    true
56}