namespace MiGu.Server.Configs; /// /// 部署画像 —— 登录后「配置向导」的结果,对应 ConfigStore 的 deployment section /// (持久化于 data/config-deployment.json)。 /// /// 它是「按选型裁剪」的单一事实来源: /// /// =false 时,登录返回 NeedsWizard=true,前端跳转配置向导; /// 映射为 SimpleLite 场景 id, /// 由 Launcher 写入 plugins/active-scenes.json / 透传 --scenes,驱动内核「选择性加载」导航场景插件; /// 驱动平台菜单与能力裁剪(PageCatalog 可见页)。 /// /// /// 向导是否已完成。false = 登录后强制进入配置向导。 /// 平台主定位(仅用于 UI 标题/默认值),如 standard / wcs / wms-wcs / custom。 /// 启用的功能模块(多选),暂定 wms / ptl。 /// 导航方式(多选,一等维度),取值 magnetic / qrcode / laser,与 SimpleCore.NavKind 对齐。 /// 选用的业务场景模板 id(来自 ScenarioTemplateConfig),如 tpl-sps / tpl-pack。 /// 最近一次保存向导的用户名(审计用)。 public record DeploymentProfile( bool Configured, string PlatformType, List Modules, List NavigationKinds, List Scenarios, string UpdatedBy) { public static DeploymentProfile Default() => new( Configured: false, PlatformType: "standard", Modules: new List(), NavigationKinds: new List(), Scenarios: new List(), UpdatedBy: ""); /// /// 导航方式 → SimpleLite 场景 id 映射。与 scene.json.idSimpleCore.Navigation.NavKind /// 以及内核 active-scenes.json.activeScenes 一致;这是平台与内核之间「导航选型」的契约约定。 /// public static readonly IReadOnlyDictionary NavKindToSceneId = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["magnetic"] = "scene.magnetic", ["qrcode"] = "scene.qrcode", ["laser"] = "scene.laser", }; /// /// 把已选 映射为 SimpleLite 激活场景 id 列表(去重、忽略未知项、保持选择顺序)。 /// 供 Launcher 写 active-scenes.json / 拼 --scenes 参数使用。 /// public IReadOnlyList ToActiveSceneIds() { var result = new List(); if (NavigationKinds == null) return result; foreach (var k in NavigationKinds) { if (string.IsNullOrWhiteSpace(k)) continue; if (NavKindToSceneId.TryGetValue(k.Trim(), out var sceneId) && !result.Contains(sceneId)) result.Add(sceneId); } return result; } }