/** * Settings card model (PR1) — pure projection of DashboardSettings + viewer * capability into a 3-section card DTO (access / cards / maintenance). * * Zero IO. Type-only imports. The input shape mirrors * `src/dashboard/web/settings-page.tsx` but is redeclared locally so the model * does not pull in browser-side jsdom assets. */ import type { ButtonState } from './card-model-types.js'; /** Single maintenance task: enabled flag + optional HH:MM time. */ export interface MaintenanceTaskCfgInput { enabled?: boolean; time?: string; } /** Maintenance section input — auto-update drives the schedule, auto-restart is dependent. */ export interface MaintenanceCfgInput { autoUpdate?: MaintenanceTaskCfgInput; autoRestart?: MaintenanceTaskCfgInput; } /** Raw dashboard settings as persisted in ~/.botmux/config.json's `dashboard` + `maintenance` segments. */ export interface DashboardSettingsInput { publicReadOnly: boolean; openTerminalInFeishu: boolean; enableLocalCliOpen: boolean; maintenance: MaintenanceCfgInput; localDevInstall: boolean; /** Defaults to supported when absent for older dashboard payloads. */ autoUpdateSupported?: boolean; } /** Optional viewer context — `canWrite=false` greys every toggle and surfaces a top-level hint. */ export interface ComposeOptions { /** True when the viewer has write capability (`/api/settings` PUT allowed). Defaults to true. */ canWrite?: boolean; } export type SettingsSectionKey = 'access' | 'cards' | 'maintenance'; export type SettingsToggleKey = 'publicReadOnly' | 'openTerminalInFeishu' | 'enableLocalCliOpen' | 'autoUpdate' | 'autoRestart'; /** A single toggle row inside a settings section. */ export interface SettingsToggleDTO { key: SettingsToggleKey; /** i18n label key — renderer translates via t(). */ labelKey: string; /** i18n hint/help key — renderer translates via t(). */ hintKey: string; /** Current on/off state. */ enabled: boolean; /** UI disabled / enabled state (greyed when disabled). */ state: ButtonState; /** Sub-control: HH:MM time field. Only `autoUpdate` emits this. */ time?: { value: string; state: ButtonState; }; } /** A vertical section in the settings card — fixed order: access → cards → maintenance. */ export interface SettingsSectionDTO { key: SettingsSectionKey; titleKey: string; toggles: SettingsToggleDTO[]; /** Optional banner shown below toggles (e.g. localDev warning under maintenance). */ hintKey?: string; } /** The full settings card DTO. */ export interface SettingsCardDTO { sections: SettingsSectionDTO[]; /** Top-level read-only banner, set when `canWrite=false`. */ readOnlyHintKey?: string; } /** Auto-update requires a published install owned by a supported package manager. */ export declare function shouldDisableAutoUpdate(settings: DashboardSettingsInput): boolean; /** Auto-restart depends on auto-update being explicitly enabled. */ export declare function shouldDisableAutoRestart(settings: DashboardSettingsInput): boolean; /** Coerce a maintenance time value into a valid HH:MM string; falls back to '04:00'. */ export declare function formatTimeForDisplay(time: string | undefined | null): string; /** Build the full 3-section settings card DTO from raw settings + viewer caps. */ export declare function composeSections(settings: DashboardSettingsInput, opts?: ComposeOptions): SettingsCardDTO; //# sourceMappingURL=settings-card-model.d.ts.map