use async_trait::async_trait;
use uuid::Uuid;
use crate::error::dpp::DppError;
use crate::ports::registry_sync::{
RegistrationRequest, RegistryRecord, RegistrySyncPort, SubmissionAcknowledgement,
SubmissionReport,
};
pub struct GhostRegistrySync;
#[async_trait]
impl RegistrySyncPort for GhostRegistrySync {
async fn register(
&self,
_request: RegistrationRequest,
) -> Result<SubmissionAcknowledgement, DppError> {
Ok(SubmissionAcknowledgement::Accepted {
correlation_id: format!("GHOST-CORR-{}", Uuid::now_v7()),
})
}
async fn check_submission(&self, correlation_id: &str) -> Result<SubmissionReport, DppError> {
Err(DppError::NotFound(format!(
"ghost registry has no submission {correlation_id}"
)))
}
async fn check_status(&self, registration_id: &str) -> Result<RegistryRecord, DppError> {
Err(DppError::NotFound(format!(
"ghost registry has no record {registration_id}"
)))
}
async fn notify_transfer(
&self,
record: &crate::transfer::TransferRecord,
_registration_id: &str,
) -> Result<RegistryRecord, DppError> {
Err(DppError::NotFound(format!(
"ghost registry has no record for {}",
record.passport_id
)))
}
}