use super::types::{PortDefinition, ScriptActorMetadata};
use anyhow::Result;
use async_trait::async_trait;
use reflow_actor::message::Message;
use serde_json::Value;
use std::collections::HashMap;
#[async_trait]
pub trait ScriptActor: Send + Sync + 'static {
async fn process(
&mut self,
inputs: HashMap<String, Message>,
) -> Result<HashMap<String, Message>>;
fn get_inports(&self) -> Vec<PortDefinition>;
fn get_outports(&self) -> Vec<PortDefinition>;
fn get_metadata(&self) -> ScriptActorMetadata;
async fn initialize(&mut self) -> Result<()> {
Ok(())
}
async fn cleanup(&mut self) -> Result<()> {
Ok(())
}
async fn get_state(&self) -> Result<Value> {
Ok(Value::Null)
}
async fn set_state(&mut self, _state: Value) -> Result<()> {
Ok(())
}
}