use std::future::Future;
use std::path::Path;
use aws_sdk_s3::primitives::ByteStream;
use chrono::DateTime;
use chrono::Utc;
use tokio::fs::File;
use tokio::fs::ReadDir;
use crate::Res;
pub mod auth;
mod local;
pub use local::LocalStorage;
#[cfg(test)]
pub mod mocks;
pub trait Storage {
fn copy(
&self,
from: impl AsRef<Path> + Send,
to: impl AsRef<Path> + Send,
) -> impl Future<Output = Res<u64>> + Send;
fn create_dir_all(&self, path: impl AsRef<Path> + Send) -> impl Future<Output = Res> + Send;
fn create_file(&self, path: impl AsRef<Path>) -> impl Future<Output = Res<File>>;
fn exists(&self, path: impl AsRef<Path>) -> impl Future<Output = bool>;
fn modified_timestamp(
&self,
path: impl AsRef<Path>,
) -> impl Future<Output = Res<DateTime<Utc>>>;
fn open_file(&self, path: impl AsRef<Path> + Send) -> impl Future<Output = Res<File>> + Send;
fn read_byte_stream(
&self,
path: impl AsRef<Path> + Send + Sync,
) -> impl Future<Output = Res<ByteStream>> + Send + Sync;
fn read_dir(
&self,
path: impl AsRef<Path> + Send + Sync,
) -> impl Future<Output = Res<ReadDir>> + Send + Sync;
fn read_file(
&self,
path: impl AsRef<Path> + Send + Sync,
) -> impl Future<Output = Res<Vec<u8>>> + Send + Sync;
fn remove_dir_all(&self, path: impl AsRef<Path> + Send) -> impl Future<Output = Res> + Send;
fn remove_file(
&self,
path: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<(), std::io::Error>> + Send;
fn rename(
&self,
from: impl AsRef<Path> + Send,
to: impl AsRef<Path> + Send,
) -> impl Future<Output = Res> + Send;
fn write_byte_stream(
&self,
path: impl AsRef<Path> + Send + Sync,
body: ByteStream,
) -> impl Future<Output = Res> + Send + Sync;
fn write_file(
&self,
path: impl AsRef<Path> + Send + Sync,
bytes: &[u8],
) -> impl Future<Output = Res> + Send + Sync;
}