use serde::{Deserialize, Serialize};
use crate::model::{Commit, EntryDataType};
use crate::view::entry::ResourceVersion;
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub enum ImgColorSpace {
RGB,
RGBA,
Grayscale,
GrayscaleAlpha,
Rgb16,
Rgba16,
Grayscale16,
GrayscaleAlpha16,
Rgb32F,
Rgba32F,
Unknown,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct MetadataText {
pub num_lines: usize,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct MetadataImage {
pub width: usize,
pub height: usize,
pub color_space: ImgColorSpace, }
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct MetadataVideo {
pub num_seconds: f64,
pub width: usize,
pub height: usize,
pub color_space: ImgColorSpace, pub format: String, }
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct MetadataAudio {
pub num_seconds: f64,
pub format: String, pub num_channels: usize,
pub sample_rate: usize,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct MetadataTabular {
pub width: usize,
pub height: usize,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct MetadataItem {
pub text: Option<MetadataText>,
pub image: Option<MetadataImage>,
pub video: Option<MetadataVideo>,
pub audio: Option<MetadataAudio>,
pub tabular: Option<MetadataTabular>,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct CLIMetadataEntry {
pub filename: String,
pub last_updated: Option<Commit>,
pub hash: String,
pub size: u64,
pub data_type: EntryDataType,
pub mime_type: String,
pub extension: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct MetadataEntry {
pub filename: String,
pub is_dir: bool,
pub latest_commit: Option<Commit>,
pub resource: Option<ResourceVersion>,
pub size: u64,
pub data_type: EntryDataType,
pub mime_type: String,
pub extension: String,
}