use std::future::Future;
use std::time::Duration;
use crate::pairing::{
CreateSessionRequest, CreateSessionResponse, GetConfirmationResponse, GetSessionResponse,
SubmitConfirmationRequest, SubmitResponseRequest,
};
use crate::ports::network::NetworkError;
pub trait PairingRelayClient: Send + Sync {
fn create_session(
&self,
registry_url: &str,
request: &CreateSessionRequest,
) -> impl Future<Output = Result<CreateSessionResponse, NetworkError>> + Send;
fn get_session(
&self,
registry_url: &str,
session_id: &str,
) -> impl Future<Output = Result<GetSessionResponse, NetworkError>> + Send;
fn lookup_by_code(
&self,
registry_url: &str,
code: &str,
) -> impl Future<Output = Result<GetSessionResponse, NetworkError>> + Send;
fn submit_response(
&self,
registry_url: &str,
session_id: &str,
response: &SubmitResponseRequest,
) -> impl Future<Output = Result<(), NetworkError>> + Send;
fn wait_for_update(
&self,
registry_url: &str,
session_id: &str,
timeout: Duration,
) -> impl Future<Output = Result<Option<GetSessionResponse>, NetworkError>> + Send;
fn submit_confirmation(
&self,
url: &str,
session_id: &str,
request: &SubmitConfirmationRequest,
) -> impl Future<Output = Result<(), NetworkError>> + Send;
fn get_confirmation(
&self,
url: &str,
session_id: &str,
) -> impl Future<Output = Result<GetConfirmationResponse, NetworkError>> + Send;
fn wait_for_confirmation(
&self,
url: &str,
session_id: &str,
timeout: Duration,
) -> impl Future<Output = Result<Option<GetConfirmationResponse>, NetworkError>> + Send;
}