use super::design_identity::{fresh_design_uuid, resolve_design_uuid, resolve_file_design_uuid};
use indicatrix_cut_core::native::{AttachmentBlob, DesignMetadata};
use std::path::Path;
#[derive(Debug, Clone, Default)]
pub(in crate::gui) struct DesignFileExtras {
pub(in crate::gui::editor) metadata: DesignMetadata,
pub(in crate::gui::editor) attachments: Vec<AttachmentBlob>,
}
impl DesignFileExtras {
pub(in crate::gui::editor) const fn new(
metadata: DesignMetadata,
attachments: Vec<AttachmentBlob>,
) -> Self {
Self {
metadata,
attachments,
}
}
pub(in crate::gui::editor) fn with_design_uuid_assigned(
mut self,
catalogue_url: Option<&str>,
) -> Self {
self.metadata.id = resolve_design_uuid(&self.metadata.id, catalogue_url, fresh_design_uuid);
self
}
pub(in crate::gui::editor) fn with_design_uuid_assigned_for_file(
mut self,
path: &Path,
) -> Self {
self.metadata.id = resolve_file_design_uuid(&self.metadata.id, path, fresh_design_uuid);
self
}
}