use pyo3::FromPyObject; use python_utils::{FromPyFromStr, ToStrToPy}; use string_literal::StringLiteral; use crate::{entity_id::EntityId, state_object::StateObject}; #[derive(Debug, Clone, StringLiteral, FromPyFromStr, ToStrToPy)] #[string_literal(value = "state_changed")] pub struct Type; #[derive(Debug, FromPyObject)] #[pyo3(from_item_all)] pub struct Data< OldState, OldAttributes, OldStateContextEvent, NewState, NewAttributes, NewStateContextEvent, > { pub entity_id: EntityId, pub old_state: Option>, pub new_state: Option>, } /// A state changed event is fired when on state write the state is changed. pub type Event< OldState, OldAttributes, OldStateContextEvent, NewState, NewAttributes, NewStateContextEvent, Context, > = super::super::Event< Type, Data< OldState, OldAttributes, OldStateContextEvent, NewState, NewAttributes, NewStateContextEvent, >, Context, >;