#![allow(dead_code)]
#[cfg(feature = "embedded")]
pub mod embedded;
#[cfg(feature = "http")]
pub mod http;
use std::time::Duration;
use chrono::{DateTime, Utc};
use crate::error::Result;
use crate::types::{CheckpointResult, CustomSignal, Signal, SignalType, StatusResponse};
pub trait SdkBackend: Send + Sync {
fn connect(&self) -> Result<()>;
fn is_connected(&self) -> bool;
fn close(&self);
fn register(&self, checkpoint_id: Option<&str>) -> Result<()>;
fn checkpoint(&self, checkpoint_id: &str, state: &[u8]) -> Result<CheckpointResult>;
fn get_checkpoint(&self, checkpoint_id: &str) -> Result<Option<Vec<u8>>>;
fn heartbeat(&self) -> Result<()>;
fn completed(&self, output: &[u8]) -> Result<()>;
fn failed(&self, error: &str) -> Result<()>;
fn suspended(&self) -> Result<()>;
fn sleep_until(&self, checkpoint_id: &str, wake_at: DateTime<Utc>, state: &[u8]) -> Result<()>;
fn send_custom_event(&self, subtype: &str, payload: Vec<u8>) -> Result<()>;
fn record_retry_attempt(
&self,
checkpoint_id: &str,
attempt_number: u32,
error_message: Option<&str>,
) -> Result<()>;
fn get_status(&self) -> Result<StatusResponse>;
fn poll_signals(
&self,
checkpoint_id: Option<&str>,
) -> Result<(Option<Signal>, Option<CustomSignal>)>;
fn acknowledge_signal(&self, signal_type: SignalType) -> Result<()>;
fn get_instance_status(&self, instance_id: &str) -> Result<StatusResponse>;
fn load_input(&self) -> Result<Option<Vec<u8>>>;
fn instance_id(&self) -> &str;
fn tenant_id(&self) -> &str;
fn set_sleep_until(&self, sleep_until: DateTime<Utc>) -> Result<()>;
fn clear_sleep(&self) -> Result<()>;
fn get_sleep_until(&self) -> Result<Option<DateTime<Utc>>>;
fn durable_sleep(&self, duration: Duration, checkpoint_id: &str, state: &[u8]) -> Result<()>;
}