use serde::{Deserialize, Serialize};
use crate::*;
#[derive(Debug, Clone, Hash, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StorageVolume {
pub description: String,
pub is_primary: bool,
pub is_removable: bool,
pub is_stable: bool,
pub is_emulated: bool,
pub is_readonly: bool,
pub is_available_for_app_storage: bool,
pub is_available_for_public_storage: bool,
pub id: StorageVolumeId
}
#[derive(Debug, Clone, Hash, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StorageVolumeId {
pub(crate) top_dir_path: Option<std::path::PathBuf>,
pub(crate) app_data_dir_path: Option<std::path::PathBuf>,
pub(crate) app_cache_dir_path: Option<std::path::PathBuf>,
pub(crate) app_media_dir_path: Option<std::path::PathBuf>,
pub(crate) uid: Option<String>,
pub(crate) media_store_volume_name: Option<String>,
pub(crate) storage_uuid: Option<String>,
}
#[allow(unused)]
impl StorageVolumeId {
pub(crate) fn app_dir_path(&self, dir: impl Into<AppDir>) -> Option<&std::path::PathBuf> {
match dir.into() {
AppDir::Data => self.app_data_dir_path.as_ref(),
AppDir::Cache => self.app_cache_dir_path.as_ref(),
#[allow(deprecated)]
AppDir::PublicMedia => self.app_media_dir_path.as_ref()
}
}
}