CommonLibrary/SourceControlManagement/DTO/SourceControlCreateDTO.rs
1//! # SourceControlCreateDTO
2//!
3//! Defines the DTO for creating a new Source Control provider.
4
5use serde::{Deserialize, Serialize};
6use url::Url;
7
8use crate::Utility::Serialization::URLSerializationHelper;
9
10/// A serializable struct sent from the extension host (`Cocoon`) to the main
11/// host (`Mountain`) when an extension calls `vscode.scm.createSourceControl`.
12#[derive(Serialize, Deserialize, Debug, Clone)]
13#[serde(rename_all = "camelCase")]
14pub struct SourceControlCreateDTO {
15 /// The unique identifier for this source control provider.
16 #[serde(rename = "id")]
17 pub ID:String,
18
19 /// The human-readable label for this provider (e.g., "Git").
20 pub Label:String,
21
22 /// The root URI of the repository this provider is managing.
23 #[serde(with = "URLSerializationHelper")]
24 pub RootUri:Url,
25
26 /// Caller-supplied provider handle. Cocoon uses a process-local
27 /// sequential allocator (`NextProviderHandle()` in `ScmNamespace.ts`)
28 /// and includes the same handle on every subsequent
29 /// `register_scm_resource_group` / `update_scm_group` /
30 /// `unregister_scm_provider` notification. When present, Mountain MUST
31 /// key its marker maps under this handle so group-update lookups
32 /// resolve - allocating a fresh handle here keys the
33 /// `SourceControlManagementProviders` map under a value Cocoon will
34 /// never reference, and every later `update_scm_group` warns
35 /// "Received group update for unknown provider handle: <H>" while the
36 /// SCM viewlet stays empty. Optional so callers without an external
37 /// handle (none currently) still work via Mountain-side allocation.
38 #[serde(default, skip_serializing_if = "Option::is_none")]
39 pub Handle:Option<u32>,
40}