handleEvent

suspend fun handleEvent(objectStore: BusinessObjectStore, event: Event): EitherNel<EventHandlingError, BusinessObject>

This method applies an Event to this BusinessObject, potentially changing its state and properties. The new state is derived by using the type's StateMachine to determine the next State for the state and Event.type. The new property values are updated if they are provided in the Event.properties map. Otherwise, the old values are kept.

Return

A new BusinessObject with the updated state and properties.

A NonEmptyList of EventHandlingErrors if the Event cannot be applied to this BusinessObject.