use core::{fmt::Debug, future::Future};
use futures_lite::stream::Stream;
use std::ops::RangeInclusive;
use bytes::Bytes;
use crate::model::LocalFileInfo;
mod local_directory;
mod sync;
pub use local_directory::calculate_local_unix_path;
pub use sync::{Progress, State};
pub trait FileSystem {
type Error: Debug + Send;
type StorePrepare: Send;
fn all_files(&self) -> impl Future<Output = Result<Vec<LocalFileInfo>, Self::Error>> + Send;
fn prepare_store_file(&self, path: &str) -> impl Future<Output = Result<Self::StorePrepare, Self::Error>> + Send;
fn store_file(
&self,
prepared: Self::StorePrepare,
data: Bytes,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn delete_file(&self, path: &str) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
pub trait RemoteZip {
type Error: Debug + Send;
fn get_zip_size(&self) -> impl Future<Output = Result<usize, Self::Error>> + Send;
fn fetch_bytes(&self, range: RangeInclusive<usize>) -> impl Future<Output = Result<Bytes, Self::Error>> + Send;
fn fetch_bytes_stream(
&self,
range: RangeInclusive<usize>,
) -> impl Future<Output = Result<impl Stream<Item = Result<Bytes, Self::Error>> + Send, Self::Error>> + Send;
}