use crate::config::configurable::Configurable;
use crate::host::plugin_handle::PluginHandle;
use crate::plugin::types::{
PanelInteraction, PluginContext, PluginError, PluginMetadata, Query, QueryResponse,
};
use async_trait::async_trait;
use std::sync::Arc;
#[async_trait]
pub trait Plugin: Configurable {
fn metadata(&self) -> &PluginMetadata;
async fn init(
&self,
ctx: &PluginContext,
handle: Option<Arc<PluginHandle>>,
) -> Result<(), PluginError>;
async fn query(&self, ctx: &PluginContext, query: &Query)
-> Result<QueryResponse, PluginError>;
async fn execute_action(
&self,
ctx: &PluginContext,
action_id: &str,
payload: serde_json::Value,
) -> Result<(), PluginError>;
fn interaction_policy(&self) -> PanelInteraction {
PanelInteraction::default()
}
}