Mountain/ApplicationState/DTO/CustomDocumentStateDTO.rs
1//! # CustomDocumentStateDTO
2//!
3//! Defines the Data Transfer Object for storing the state of a single custom
4//! editor document.
5
6#![allow(non_snake_case, non_camel_case_types)]
7
8use std::collections::HashMap;
9
10use serde::{Deserialize, Serialize};
11use url::Url;
12
13use crate::ApplicationState::Internal::URLSerializationHelper;
14
15/// A struct that holds the state for a document being handled by a custom
16/// editor. This is stored in `ApplicationState` to track the lifecycle of
17/// custom documents.
18#[derive(Serialize, Deserialize, Debug, Clone)]
19#[serde(rename_all = "PascalCase")]
20pub struct CustomDocumentStateDTO {
21 /// The URI of the document resource being edited.
22 #[serde(with = "URLSerializationHelper")]
23 pub URI:Url,
24
25 /// The view type of the custom editor responsible for this document.
26 pub ViewType:String,
27
28 /// The identifier of the sidecar process where the custom editor provider
29 /// lives.
30 pub SideCarIdentifier:String,
31
32 /// A flag indicating if the document is currently editable by the user.
33 pub IsEditable:bool,
34
35 /// An optional identifier for a backup copy of the file's content.
36 #[serde(skip_serializing_if = "Option::is_none")]
37 pub BackupIdentifier:Option<String>,
38
39 /// A map to store edit history or other versioning information.
40 /// In a real implementation, this might hold a more structured edit type.
41 pub Edits:HashMap<u32, serde_json::Value>,
42}