Common/Configuration/DTO/ConfigurationInitializationDTO.rs
1//! # ConfigurationInitializationDTO
2//!
3//! Defines the Data Transfer Object for the complete, multi-layered
4//! configuration state of the application.
5
6use serde::{Deserialize, Serialize};
7use serde_json::Value;
8
9/// A serializable struct that represents the initial configuration data
10/// structure.
11///
12/// This DTO is typically sent from the main application (`Mountain`) to a
13/// sidecar (`Cocoon`) on startup. It provides the sidecar with a complete
14/// snapshot of all configuration sources, allowing it to accurately reflect the
15/// application's settings state without needing to read files itself.
16#[derive(Serialize, Deserialize, Debug, Clone)]
17#[serde(rename_all = "PascalCase")]
18pub struct ConfigurationInitializationDTO {
19 /// The final, merged configuration values after applying all scopes in the
20 /// correct order of precedence. This is the "effective" configuration.
21 pub Effective:Value,
22
23 /// The default values for all configurations, as defined by the application
24 /// and its extensions.
25 pub Defaults:Value,
26
27 /// User-level settings, typically from a global `settings.json` file.
28 pub User:Value,
29
30 /// WorkSpace-level settings, from a `.code-workspace` file or a folder's
31 /// `.vscode/settings.json`.
32 pub WorkSpace:Value,
33
34 /// Settings specific to individual folders in a multi-root workspace.
35 pub Folders:Value,
36
37 /// Temporary, in-memory settings that are not persisted.
38 pub Memory:Value,
39
40 /// Policy-enforced settings that cannot be overridden by the user.
41 #[serde(skip_serializing_if = "Option::is_none")]
42 pub Policy:Option<Value>,
43
44 /// Detailed scope information for each configuration key.
45 #[serde(skip_serializing_if = "Option::is_none")]
46 pub ConfigurationScopes:Option<Vec<(String, Value)>>,
47}