use async_trait::async_trait;
use uuid::Uuid;
use crate::domain::entities::{ReiWebhook, WebhookDelivery, WebhookEventType};
use crate::domain::errors::DomainError;
#[async_trait]
pub trait ReiWebhookRepository: Send + Sync {
async fn find_by_id(&self, id: Uuid) -> Result<Option<ReiWebhook>, DomainError>;
async fn find_by_rei(&self, rei_id: Uuid) -> Result<Vec<ReiWebhook>, DomainError>;
async fn find_by_rei_and_event(
&self,
rei_id: Uuid,
event: &WebhookEventType,
) -> Result<Vec<ReiWebhook>, DomainError>;
async fn save(&self, webhook: &ReiWebhook) -> Result<ReiWebhook, DomainError>;
async fn delete(&self, id: Uuid) -> Result<bool, DomainError>;
async fn set_enabled(&self, id: Uuid, enabled: bool) -> Result<bool, DomainError>;
async fn save_delivery(
&self,
delivery: &WebhookDelivery,
) -> Result<WebhookDelivery, DomainError>;
async fn find_deliveries(
&self,
webhook_id: Uuid,
limit: i32,
) -> Result<Vec<WebhookDelivery>, DomainError>;
async fn find_pending_deliveries(&self) -> Result<Vec<WebhookDelivery>, DomainError>;
}