use std::future::Future;
use std::pin::Pin;
use crate::error::Result;
use super::types::ApiKeyRecord;
pub trait ApiKeyBackend: Send + Sync {
fn store(&self, record: &ApiKeyRecord)
-> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
fn lookup(
&self,
key_id: &str,
) -> Pin<Box<dyn Future<Output = Result<Option<ApiKeyRecord>>> + Send + '_>>;
fn revoke(
&self,
key_id: &str,
revoked_at: &str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
fn list(
&self,
tenant_id: &str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ApiKeyRecord>>> + Send + '_>>;
fn update_last_used(
&self,
key_id: &str,
timestamp: &str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
fn update_expires_at(
&self,
key_id: &str,
expires_at: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
}