import type { ComponentType, ReactNode } from 'react'; import type { AutomationLocaleKey } from './locales.js'; import type { AutomationRuntime } from './runtime.js'; import type { PermissionTranslate } from './permissions.js'; import type { SessionListState, WorkspaceListState } from './schedule-rail-model.js'; export type Translate = (key: AutomationLocaleKey, params?: Record) => string; export type ModelTranslate = (key: string, params?: Record) => string; export type SessionSelector = (select: (state: SessionListState) => Selected, equals?: (left: Selected, right: Selected) => boolean) => Selected; export type WorkspaceSelector = (select: (state: WorkspaceListState) => Selected, equals?: (left: Selected, right: Selected) => boolean) => Selected; export interface AutomationViewProps { readonly t: Translate; readonly permissionT: PermissionTranslate; readonly modelT: ModelTranslate; readonly runtime: AutomationRuntime; readonly closeSettings?: () => void; readonly addWorkspace?: () => Promise; } export interface ClientRpc { call(channel: string, endpoint: string, payload: unknown, signal?: AbortSignal): Promise; } export interface SlotRegisterOptions { readonly name: string; readonly id?: string; readonly key?: string; readonly order?: number; readonly locale?: string; readonly label?: () => string; readonly icon?: string; readonly priority?: number; readonly children?: Record; readonly inject?: () => Record; } export interface ClientContext { effect(factory: () => void | (() => void), label?: string): void; get?(name: string): unknown; reflect?: { get?(name: string): unknown; }; connection: { readonly rpc: ClientRpc; }; sessions?: { refresh?: () => Promise; list?: { getSnapshot(): { ids?: readonly string[]; byId?: Record; }; }; }; uiWorkspace?: { openSession(id: string): void; }; locale: { register(namespace: string, dictionaries: { readonly zh: Record; readonly en: Record; }): () => void; bind(namespace: string): (key: string, params?: Record) => string; }; slots: { inject(name: string, register: () => void | (() => void)): void; register(options: SlotRegisterOptions, component: ComponentType): () => void; entries?(name: string): readonly unknown[]; entriesOfSlot?(name: string): readonly unknown[]; subscribe?(name: string, listener: () => void): () => void; }; } export interface NativeSwitcherProps { readonly wide?: boolean; readonly openSession?: (sessionId: string) => void; readonly open?: (sessionId: string) => void; readonly useSessions?: SessionSelector; readonly useWorkspaces?: WorkspaceSelector; readonly renderSlot?: (name: string, props?: Record, opts?: { readonly hookContext?: unknown; }) => ReactNode; }