export function createNihoPlaygroundSdkEmulator(fixtures = {}) { const calls = []; const viewer = fixtures.viewer ?? { role: "MEMBER", language: "ja", prefersReducedMotion: false, prefersHighContrast: false }; const spot = fixtures.spot ?? { displayName: "テスト拠点", theme: "SYSTEM" }; const devices = fixtures.devices ?? { actions: [] }; const records = fixtures.records ?? { records: [], nextCursor: null, totalCount: 0 }; const strings = fixtures.strings ?? {}; const editableValues = fixtures.editableValues ?? {}; return { calls, sdk: { viewer: { async get() { calls.push({ method: "viewer.get" }); return viewer; } }, spot: { async get() { calls.push({ method: "spot.get" }); return spot; } }, settings: { get(key) { calls.push({ method: "settings.get", key }); return editableValues[key]; } }, t(key) { calls.push({ method: "t", key }); return strings[key] ?? key; }, diag: { async ready() { calls.push({ method: "diag.ready" }); }, async error(input) { calls.push({ method: "diag.error", input }); }, }, ui: { async confirm(input) { calls.push({ method: "ui.confirm", input }); return fixtures.confirmResult ?? false; }, }, devices: { async list() { calls.push({ method: "devices.list" }); return devices; }, async execute(input) { calls.push({ method: "devices.execute", input }); return fixtures.deviceExecuteResult ?? { ok: true }; }, }, records: { async consent(input) { calls.push({ method: "records.consent", input }); return { ok: true }; }, async list(input) { calls.push({ method: "records.list", input }); return records; }, async append(input) { calls.push({ method: "records.append", input }); return fixtures.recordAppendResult ?? { record: { id: "record-1", data: input.data, createdAt: new Date(0).toISOString(), authoredByViewer: true } }; }, async delete(input) { calls.push({ method: "records.delete", input }); return { ok: true }; }, }, }, }; }