use async_trait::async_trait;
use chrono::{DateTime, Utc};
use rskit_errors::AppError;
use super::Key;
#[async_trait]
pub trait Store: Send + Sync {
async fn create(&self, key: Key) -> Result<(), AppError>;
async fn list_by_prefix(&self, key_prefix: &str) -> Result<Vec<Key>, AppError>;
async fn get_by_id(&self, key_id: &str) -> Result<Key, AppError>;
async fn update_last_used(&self, key_id: &str, used_at: DateTime<Utc>) -> Result<(), AppError>;
async fn set_rotation(
&self,
key_id: &str,
grace_ends_at: DateTime<Utc>,
rotated_by_id: Option<String>,
) -> Result<(), AppError>;
async fn set_active(&self, key_id: &str, active: bool) -> Result<(), AppError>;
async fn delete(&self, key_id: &str) -> Result<(), AppError>;
}