use crate::Value;
use predicator_rs::Map;
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub enum Effect {
#[non_exhaustive]
Log {
label: Option<String>,
value: Option<Value>,
content_index: usize,
owner: BlockOwner,
macrostep: u64,
microstep: u64,
round: u64,
},
#[non_exhaustive]
DatamodelChange {
location_path: Vec<PathSegment>,
location_source: String,
new_value: Value,
prior_value: Value,
data_index: Option<usize>,
content_index: Option<usize>,
owner: Option<BlockOwner>,
macrostep: u64,
microstep: u64,
round: u64,
},
#[non_exhaustive]
Send {
event: Option<Value>,
target: Option<Value>,
send_type: Option<Value>,
data: Value,
send_id: String,
id_from_author: bool,
ordinal: Option<u64>,
content_index: usize,
owner: BlockOwner,
macrostep: u64,
microstep: u64,
round: u64,
},
#[non_exhaustive]
SendDelayed {
event: Option<Value>,
target: Option<Value>,
send_type: Option<Value>,
data: Value,
send_id: String,
id_from_author: bool,
delay_ms: i64,
ordinal: u64,
content_index: usize,
owner: BlockOwner,
macrostep: u64,
microstep: u64,
round: u64,
},
#[non_exhaustive]
DatamodelInit {
datamodel: Map,
macrostep: u64,
microstep: u64,
round: u64,
},
#[non_exhaustive]
BudgetExhausted {
configuration: Vec<usize>,
budget: u64,
pending_internal_events: Vec<Value>,
macrostep: u64,
microstep: u64,
round: u64,
},
#[non_exhaustive]
Done {
donedata: Option<Value>,
donedata_error: Option<Value>,
configuration: Vec<usize>,
macrostep: u64,
microstep: u64,
round: u64,
},
#[non_exhaustive]
Cancel {
send_id: Value,
ordinal: u64,
content_index: usize,
owner: BlockOwner,
macrostep: u64,
microstep: u64,
round: u64,
},
#[non_exhaustive]
Invoke {
invoke_id: String,
invoke_type: Option<Value>,
src: Option<Value>,
params: Value,
content: Option<Value>,
autoforward: bool,
state_index: usize,
invoke_index: usize,
macrostep: u64,
microstep: u64,
round: u64,
},
#[non_exhaustive]
CancelInvoke {
invoke_id: String,
state_index: usize,
macrostep: u64,
microstep: u64,
round: u64,
},
#[non_exhaustive]
Autoforward {
invoke_id: String,
state_index: usize,
event: Value,
macrostep: u64,
microstep: u64,
round: u64,
},
#[non_exhaustive]
Child {
session_id: String,
effect: Box<Effect>,
},
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum BlockOwner {
#[non_exhaustive]
OnEntry {
state: usize,
ordinal: usize,
},
#[non_exhaustive]
OnExit {
state: usize,
ordinal: usize,
},
#[non_exhaustive]
Transition {
transition: usize,
},
#[non_exhaustive]
Invoke {
state: usize,
invoke: usize,
},
#[non_exhaustive]
Finalize {
state: usize,
invoke: usize,
},
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PathSegment {
Key(String),
Index(i64),
}