import { createStoreBackedReadModel } from './ui-read-model-helpers.js';
export function createRemoteReadModels(runtimeServices) {
    const { runtimeStore } = runtimeServices;
    return {
        remote: createStoreBackedReadModel(runtimeServices, () => {
            const state = runtimeStore.getState();
            const distributedRaw = runtimeServices.distributedRuntime.getSnapshot();
            return {
                daemon: {
                    transportState: state.daemon.transportState,
                    isRunning: state.daemon.isRunning,
                    reconnectAttempts: state.daemon.reconnectAttempts,
                    runningJobCount: state.daemon.runningJobCount,
                    lastError: state.daemon.lastError,
                },
                acp: {
                    transportState: state.acp.managerTransportState,
                    totalMessages: state.acp.totalMessages,
                    activeConnections: state.acp.activeConnectionIds
                        .map((id) => state.acp.connections.get(id))
                        .filter((connection) => connection !== undefined),
                },
                pools: runtimeServices.remoteRunnerRegistry.listPools(),
                contracts: runtimeServices.remoteRunnerRegistry.listContracts(),
                artifacts: runtimeServices.remoteRunnerRegistry.listArtifacts(),
                supervisor: runtimeServices.remoteSupervisor.getSnapshot(runtimeStore),
                distributed: {
                    pairRequests: distributedRaw.pairRequests ?? [],
                    peers: distributedRaw.peers ?? [],
                    work: distributedRaw.work ?? [],
                },
            };
        }),
    };
}
