export type Component = {
  id?: string;
  /** When omitted or `undefined`, the host shows a short “No data” placeholder. */
  json?: any;
  status?: "open" | "closed" | "first";
  edit?: "yes" | "no";
  strict_schema?: "yes" | "no";
};

/** Discriminant for `update` — which operation produced the new tree */
export type JsonViewerUpdateType =
  | "editvalue"
  | "editkey"
  | "deletenode"
  | "addnode";

export type JsonViewerUpdateDetail = {
  type: JsonViewerUpdateType;
  /** Full tree before this change (deep snapshot) */
  previous_json: any;
  /** Full tree after this change (deep snapshot) */
  json: any;
  keyPath: (string | number)[];
  oldValue?: any;
  newValue?: any;
  oldKey?: string;
  newKey?: string;
  deletedValue?: any;
};

export type Events = {
  update: JsonViewerUpdateDetail;
};
