'use client';

/**
 * Write-style command stubs — `fill`, `click`.
 *
 * Filling an input or clicking a control changes the user's data, so
 * each needs an explicit confirmation gate before it can be enabled.
 * They are registered (so they appear in `__chatBridge.help()`) but
 * intentionally not implemented yet.
 */

import { log } from '../logger';
import { registerBridgeCommand } from '../registry';
import type { CSTRefId } from '../overlay/types';

/**
 * Stub for a future write-style command. Filling an input changes the
 * user's data, so it needs an explicit confirmation gate before it can
 * be enabled — intentionally not implemented yet.
 */
export const fill = registerBridgeCommand({
  name: 'fill',
  description: 'fill(ref, value) — [not implemented] type into an input',
  mutates: true,
  run: (ref: CSTRefId, value: string): { ok: false; reason: string } => {
    log.warn('bridge.fill: not implemented (needs a confirmation gate)', {
      ref,
      value,
    });
    return { ok: false, reason: 'not-implemented' };
  },
});

/** Stub for a future write-style command — see `fill`. */
export const click = registerBridgeCommand({
  name: 'click',
  description: 'click(ref) — [not implemented] click an element',
  mutates: true,
  run: (ref: CSTRefId): { ok: false; reason: string } => {
    log.warn('bridge.click: not implemented (needs a confirmation gate)', {
      ref,
    });
    return { ok: false, reason: 'not-implemented' };
  },
});
