use serde::Serialize;
#[cfg(target_arch = "wasm32")]
use tsify_next::Tsify;
use crate::layout::details::Details;
use crate::layout::details::Platform;
#[derive(Serialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(target_arch = "wasm32", derive(Tsify))]
pub struct FrameDetails {
pub total_time: f32,
pub total_distance: f32,
pub max_height: f32,
pub max_horizontal_speed: f32,
pub max_vertical_speed: f32,
pub photo_num: i32,
pub video_time: i64,
pub aircraft_name: String,
pub aircraft_sn: String,
pub camera_sn: String,
pub rc_sn: String,
pub app_platform: Platform,
pub app_version: String,
}
impl From<Details> for FrameDetails {
fn from(value: Details) -> Self {
FrameDetails {
total_time: value.total_time as f32,
total_distance: value.total_distance,
max_height: value.max_height,
max_horizontal_speed: value.max_horizontal_speed,
max_vertical_speed: value.max_vertical_speed,
photo_num: value.capture_num,
video_time: value.video_time,
aircraft_name: value.aircraft_name.clone(),
aircraft_sn: value.aircraft_sn.clone(),
camera_sn: value.camera_sn.clone(),
rc_sn: value.rc_sn.clone(),
app_platform: value.app_platform.clone(),
app_version: value.app_version.clone(),
}
}
}