use async_trait::async_trait;
use crate::{
error::{ShieldError, StorageError},
request::Request,
response::Response,
user::{CreateEmailAddress, CreateUser, UpdateUser},
};
#[async_trait]
pub trait Hooks: Send + Sync {
async fn request(&self, action_id: &str, request: Request) -> Result<Request, ShieldError>;
async fn response(&self, action_id: &str, response: Response) -> Result<Response, ShieldError>;
async fn method_request(
&self,
action_id: &str,
method_id: &str,
provider_id: Option<&str>,
request: Request,
) -> Result<Request, ShieldError>;
async fn method_response(
&self,
action_id: &str,
method_id: &str,
provider_id: Option<&str>,
response: Response,
) -> Result<Response, ShieldError>;
async fn create_user(
&self,
user: CreateUser,
email_address: CreateEmailAddress,
) -> Result<(CreateUser, CreateEmailAddress), StorageError>;
async fn update_user(&self, user: UpdateUser) -> Result<UpdateUser, StorageError>;
async fn delete_user(&self, user_id: &str) -> Result<(), StorageError>;
}